You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by jitender ahuja <aj...@aalayance.com> on 2004/06/28 15:55:47 UTC

AND & OR over fields to be searched upon

Hi All,
          -Doug submitted  a reply concerning a weighted ranking based on the query term containing field, using an OR search, dated
 21 Aug 2002. His reply was as follows for higher ranking of field1 over field2:
"Index the text in both field1 and field2 in a new field, field3.  (Or, to save space and if your application permits, just add the text from 
field1 to field2 too.)  Then search for:   field1:(token1^2 token2^2 token3^2) +field3:(+token1 +token2 +token3)"

Now, my issue is that I want both options 'AND' as well as 'OR'. So, if it is 'Or' then the term(s) can be found in any one or more and 
I need to display the field in which the particular occurence in the Hits array was found. But, if  the 'AND' condition is used then it 
must be found in all. The MultiQueryParser class does an 'OR' search. But, how to display the field in which the particular Hits' 
array item was found in case of 'OR' search.The fields to be combined and the AND/OR options are choosen from a multiple select box 
and a text box respectively by the user.

Regards,
Jitender