Is there a way to filter query, so I will get documents with specific array filed containing at least one other value except of values which I pass.
For example I have 3 docs.
<doc>
<arr name="my_array">
<int>2</int>
<int>4</int>
</arr>
</doc>
<doc>
<arr name="my_array">
<int>2</int>
</arr>
</doc>
<doc>
<arr name="my_array">
<int>4</int>
<int>3</int>
<int>1</int>
</arr>
</doc>
I want documents which contains at least one other value in my_array
except of 2 and 4.
So result will be:
<doc>
<arr name="my_array">
<int>4</int>
<int>3</int>
<int>1</int>
</arr>
</doc>
You can try
qf=my_array&q=+(2 4) +([* TO 1] [3 TO 3] [5 TO *])
This translates to
I know that the between 3 and 3
is a bit strange, but that is due to the example.
The caveat of this is that you need to calculate the query on the client side to get the range clauses right. Although the logic to compute this is not too hard.
I have tried this with eDisMax, which is configured like this
<requestHandler name="standard" class="solr.StandardRequestHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="fl">*,score</str>
<str name="mm">1</str>
</lst>
</requestHandler>
<queryParser name="edismax"
class="org.apache.solr.search.ExtendedDismaxQParserPlugin" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With