I am currently trying to get some fulltext querying done in Lucene. What I would like to achieve is the following:
Upon getting a search term like
"hello AND world"
I would like a query that searches for both terms on all fields. However, both terms do not have to occur in only one field but have to occur in all the fields.
Thus, the result should look like:
+(field1:hello field2:hello) +(field1:world field2:world)
When using a MultiFieldQueryParser I only get the following:
(+field1:hello +field1:world) (+field2:hello +field2:world)
As I understood, this requires every term to occur in only one field.
Is there any chance to get such a behavior realised using default Lucene features, or do I have to implement my own query parser?
My current approach is to concatenate all the field contents on the domain object in only one field and query only that one. However, this approach is pretty ugly...
Thanks, Matthias