0
votes

I wish to query a Lucene index and ask the question "..does the string ABC occur in Field A AND string DEF in Field B ..."

BOTH conditions (ABC in Field A and DEF in Field B) must be true ....I've fooled around with a few searches and don't seem to be hit the proper combination.

Any ideas / examples ...seems that the MultiFieldQueryParser may be the answer but I've had no luck so far.

2

2 Answers

0
votes

The standard query parser supports this sort of query, like:

+fielda:ABC +fieldb:DEF

The + character is the required operator, so this query will require a match on both fielda:ABC and fieldb:XYZ.

See the query parser syntax documentation, for more information.

MultiFieldQueryParser is used to automatically search for the same content in multiple fields, so not quite what you are looking for.

0
votes

Turns out on a SOLR browser search, the q.OP=AND on the URL will provide the ANDING condition I was looking for.