Reputation: 469
I have a solr index that's indexing items with multiple tags (multivalued)
for example :
<item>
<name>America x</name>
<id>1</id>
<tags>
<tag>Edward Norton</tag>
<tag>Beverly D'Angelo</tag>
<tag>Ethan Suplee</tag>
</tags>
</item>
<item>
<name>The score</name>
<id>2</id>
<tags>
<tag>Robert De Niro</tag>
<tag>Edward Norton</tag>
<tag>Marlon Brando</tag>
</tags>
</item>
I would like to perform a query that will find the closest match to searching "Rebert De Niro" AND "Edward Norton" AND "Ben Stiller"
The complexity is, that there isn't an item that includes all the 3 tags mentioned, but the closest is the second item that has 2 out of 3 tags.
I wouldn't want to perform a manual permutation combined query since it can get complex if I search for many tags all at once.
Upvotes: 0
Views: 558
Reputation: 52822
See the mm
parameter (minimum match) available in (e)dismax. This allows you to say the number of clauses that should match, or the minimum number of matches necessary. As long as you specify AND, you'll require that all clauses are present.
You can also specify OR - documents matching more terms should be scored higher automagically iirc. See debugQuery to see how the scoring for each match has been calculated.
Upvotes: 1