问题
I have the following model for a type of document in Solr 5:
- 1 document per entity
- entity has about 100 single valued attributes
- entity has 1 multi valued attribute
uuids_scores
, which contains a value like "123_456", being the first part (123) the user id and the second part (456) a stored score I keep for each user. - an entity can have about 100 k uuids_scores values.
The way I am trying to use this is:
I search for entities where uuids_scores:123_*
and I get the list of entities I want.
Then I read in the answer all single attributes + the matched values inside uuids_scores
multi valued field.
I found a way of doing it in this question: How to filter values returned on a multivalued field in Solr
Considering as a requirement my writes should be as fast as possible, so any solution that would require storing 100k entities instead of one wouldn't work for me.
The question now is: is there a better model to do what I want? Is there a better solution for this?
回答1:
Try with dynamic fields, index fields could be like "uuids_scores_123"
<dynamicField name="uuid_scores_*" type="int" indexed="true" stored="true" multivalued="true"/>
you can query over "uuids_scores_123:*" and include only "uuids_scores_123" in returned fields. It will have only the results you want.
来源:https://stackoverflow.com/questions/29542735/best-solr-model-when-searching-inside-multivalued-fields