George Livanoss
George Livanoss

Reputation: 599

solr: partial document update or join?

i have an index of products in solr (the index is updated with DataImport from a mysql/jdbc).

the products can be available or not in some store: right now we have this model in the index (the stores are a multivalued int field)

{
 id:
 product_id:
 stores: [ store_id, store_id, ...] 
 ...
}

the stores field in gonna be changed very often, with an external tool that updates the solr document, changing only the value in the array.

is this the best pattern to model this in solr? could be better to have separate documents and then join?

Upvotes: 1

Views: 149

Answers (1)

Persimmonium
Persimmonium

Reputation: 15789

depends on what is very often for you, it might be ok to just update the whole doc...But, if it is going to be a problem and you wish to optimize the load due to the constant updating, you have several options:

  1. In place updates you have some constraints (how to encode the list of stores in a numeric), but would work
  2. ExternalFileField
  3. Nested docs
  4. Different collections and join across them as you mention

I would prefer 1 myself, more integrated with the rest of Solr than 2...3 and 4 are not a good fit imho.

Upvotes: 2

Related Questions