0

Is there a recommended way of migrating from Spring Data JPA to Spring Data Solr ? My spring mvc app works alright using Spring Data JPA but we now want blazing fast results delivered from our data access layer. Is there a (simple) tutorial that helps integrate/migrate from JPA to Solr ?

happybuddha
  • 1,271
  • 2
  • 20
  • 40
  • Is the reading from the DB or writing to the DB the performance bottleneck? – geoand Apr 09 '14 at 06:02
  • At the moment its just reading from the db. We also have a lot of published views that we join on in our queries - Would this deter Solr/j 's abilities ? – happybuddha Apr 09 '14 at 06:12
  • 1
    If only reading is your problem, then I think that replacing JPA with Solr as you primary datastore might be overkill. A solution that is commonly employed and that seems to work well is to update the search index (whether this is Solr or ElasticSearch) when an entity is updated. I will try to find some posts for this and post them here – geoand Apr 09 '14 at 06:30

1 Answers1

1

If you simply want to keep a search index in sync with your main data store (which would continue to function exactly like it is now) then you can check out the following links

1,2,3

The links use ElasticSearch instead of Solr, but the switch should be straightforward.

One more thing you could do in order to make your architecture more scalable, is to use the Entity Event Listeners not to update the Search index, but to add an event to a message queue like RabbitMQ. Then you could use multiple workers to read events from the message queue and then update the search index.

Community
  • 1
  • 1
geoand
  • 60,071
  • 24
  • 172
  • 190
  • Would the elastic search listener work equally well for JpaRepository ? – happybuddha Apr 09 '14 at 07:31
  • I think that in order to tap into the listener functionality, you will have to use some extra configuration that takes into account the JPA provider. I don't think Spring Data JPA has listener functionality built in yet. However everything else you are doing in Spring Data JPA would work as is – geoand Apr 09 '14 at 07:55