Solr Searching Multivalued Fields
I have a multivalued field that appears like this :
<arr name="some_name">
<str>a-value-1 a-value-2 ....a-value-n</str>
<str>b-value-1 b-v开发者_StackOverflowalue-2 ....b-value-m</str>
</arr>
where n and m could be arbitrarily large(assume values in each <str>
come from a paragraph in a page or something).
How would I search so that the result contains only the documents where all search parameters are contained in the same <str>
entity(That is without generating any false positive)?
For instance if the document A has this :
<arr name="some_name">
<str>london foo-1 foo-2 ...foo-k 2012 foo-k+1 foo-k+2 ...foo-k+n</str>
<str>beijing bar-1 bar-2 ....bar-j 2008 bar-j+1 bar-j+2 ....bar-j+m</str>
</arr>
what will be the query that would not include document A in the result when searching for the words london AND 2008?
If I were to try something like this some_name:("london AND 2008"~n)
, I don't know what the value of n would be.
Consider using a high positionIncrementGap, which will help to separate the multivalued tokens and cross matching across different multivalued entries.
However, even this wont be a foolproof solution.
精彩评论