You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Pradeep Kumar K <pr...@robosoftin.com> on 2002/06/09 07:36:14 UTC

Combining queries using OR

Hi All

   How to combine more  queries using 'OR' operator. For example

Two queries are

  Query quer1=QueryParser.parse(String query1,String field1,analyzer)
  Query quer2=QueryParser.parse(String query2,String field2,analyzer)

How can I combine these two queries using 'OR' operator i.e. ultimately 
query should be one like

quer1 OR quer2


Regards
Pradeep





--------------------------------------------------------------
Robosoft Technologies, Mangalore, India



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Combining queries using OR

Posted by Joshua O'Madadhain <jm...@cse1k.ICS.UCI.EDU>.
On Sun, 9 Jun 2002, Pradeep Kumar K wrote:

>    How to combine more  queries using 'OR' operator. For example
>
> Two queries are
>
>   Query quer1=QueryParser.parse(String query1,String field1,analyzer)
>   Query quer2=QueryParser.parse(String query2,String field2,analyzer)
>
> How can I combine these two queries using 'OR' operator i.e. ultimately
> query should be one like
>
> quer1 OR quer2

Take a look at BooleanQuery.  You want to add quer1 and quer2 to a
BooleanQuery such that each is neither prohibited nor required (this will
make more sense once you see the interface).

Regards,

Joshua O'Madadhain

  jmadden@ics.uci.edu....Obscurium Per Obscurius....www.ics.uci.edu/~jmadden
   Joshua O'Madadhain: Information Scientist, Musician, Philosopher-At-Tall
It's that moment of dawning comprehension that I live for.  -- Bill Watterson
 My opinions are too rational and insightful to be those of any organization.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>