Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53607

How to manage two different entities in SOLR?

I have several different entities I want to index in SOLR, for example:

  1. users
  2. products
  3. blogs

All are completely different in schema.
All are searched for in different places in my app.
Is there a way to do it in the same core? Is it the right approach?
Is a core the conceptual equivalence of a table in a relational DB (In which case the answer is obvious).

Upvotes: 1

Views: 851

Answers (2)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99750

Really depends on how you will search this data. The main question is: What will you search for?

If you will search for products (i.e. the search results are products), then design the schema around products. If you search for products by users or blogs, model users/blogs as dynamic/multivalued fields.

If you have an app that searches for products, and another app that searches for blogs, and they're completely unrelated, put them in separate cores.

From the Solr wiki:

The more heterogeneous (different kinds of data) you have in one field or in one index, the less useful it is.

So don't blindly put everything in a single core. Carefully consider what your search scenarios are.

Upvotes: 1

Paige Cook
Paige Cook

Reputation: 22555

Here is some guidance from the Solr Wiki on Flattening Data into a Single Index. The key take away from flattening data is:

This type of approach can be particularly well suited to situations where you need to "blend" results from conceptually distinct sets of documents.

If you want to index your three types and keep them separate and distinct, you can leverage Cores within Solr to keep them fairly isolated, but allow you to manage them under one Solr container.

Upvotes: 0

Related Questions