azure - Lucene BooleanQuery - Must be present in one of two columns -
azure - Lucene BooleanQuery - Must be present in one of two columns -
not sure how format query in lucene. scenario search term must nowadays in 1 of 2 columns (either 1 fine).
boolquery.add(query1, occur.must) 'this 1 fine boolquery.add(query2, occur.should) boolquery.add(query3, occur.should)
brings results when search term not nowadays @ in column 2 , column 3.
boolquery.add(query2, occur.must) boolquery.add(query3, occur.should)
does not bring results when search term nowadays in column 3 not in column 2.
how format query equivalent of this:
where column 1= val1 , (column 2 = val2 or column 3 = val2)
must, name suggests, makes occurrence mandatory. should means optional. first boolean query match documents nail first clause, if of them can nail sec or 3rd clause, score higher. results match desired linq
(i assume that's is) statement, should work (using java).
booleanquery q = new booleanquery(); booleanquery subquery = new booleanquery(); subquery.addclause(new booleanclause(q2,occur.should)); subquery.addclause(new booleanclause(q3,occur.should)); q.addclause(new booleanclause(q1, occur.must)); q.addclause(new booleanclause(subquery,occur.must));
your confusion stems fact query api implements must , should unary operators, while in traditional programming languages and
, or
binary operators
azure lucene indexing
Comments
Post a Comment