Question

Given a white space tokenized field containing only numbers, I want to write a query able to match the documents containing:

1) ALL the numbers in a Set A

AND

2) At least one of the numbers in a Set B

This is what I wrote

q=wstf:( 1 AND 2 AND 3 AND 4 ) AND ( 5 OR 6 OR 7 OR 8 )  // (Set A) AND (Set B)

I remember (but I might be wrong) that it is possible to specify the default operator within the expression (I'm NOT talking about the q.op parameter) in order to get something like

q=wstf:(AND 1 2 3 4) AND wstf:(OR 5 6 7 8)

But I cannot find anything like this in the Reference Guide.

EDIT

Please, notice I set the default operator to AND

Any help?

Was it helpful?

Solution

You will only be able to leave off the operator you specified as default, in your case AND, and combine the query in one statement:

q=wstf:(1 2 3 4 (5 OR 6 OR 7 OR 8))

That is not as nice and short as you hoped to get, but at least a little bit shorter...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top