Question

I need to know what is the recommended solution when I want to index my solr data using multiple queries and entities. I ask because I have to add a new fields into schema.xml configuration. And depends of entity(query) there should be different fields definition.

query_one = "select * from car"
query_two = "select * fromm user"

Tables car and user have differents fields, so I should include this little fact in my schema.xml config (when i will be preparing fields definition).

Maybe someone of you creates a new solr instance for that kind of problem ?

I found something what is call MultiCore. Is it alright solution for my problem ?

Thanks

Was it helpful?

Solution

Solr does not stop you to host multiple entities in a single collection.
You can define the fields for both the entities and have them hosted within the Collection.
You would need to have an identifier to identify the Entities, if you want to filter the results per entity.

If your collections are small or there is a relationship between the User and Car it might be helpful to host them within the same collection

For Solr Multicore Check Answer Solr Multicore is basically a set up for allowing Solr to host multiple cores.
These Cores which would host a complete different set of unrelated entities.
You can have a separate Core for each table as well.

For e.g. If you have collections for Documents, People, Stocks which are completely unrelated entities you would want to host then in different collections

Multicore setup would allow you to

  1. Host unrelated entities separately so that they don't impact each other
  2. Having a different configuration for each core with different behavior
  3. Performing activities on each core differently (Update data, Load, Reload, Replication)
  4. keep the size of the core in check and configure caching accordingly

Its more a matter of preference and requirements.

OTHER TIPS

The main question for you is whether people will search for cars and users together. If not (they are different domains), you can setup multiple collections/cores. If they are going to be used together (e.g. a search for something that shows up in both cars and people), you may want to merge them into one index.

If you do use single collection for both types, you may want to setup dedicated request handlers returning different sets of fields and possibly tuning the searches. You can see an example of doing that (and a bit more) in the multilingual example from my book.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top