lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Do AND + OR Search in Lucene
Date Thu, 02 Aug 2007 12:59:23 GMT
Alternatively, construct a parenthesized query that
reflects what you want. If you do, make sure that OR is capitalized,
or make REAL SURE you understand the Lucene syntax and construct
your query with that syntax.

Erick

On 8/2/07, testn <test1@doramail.com> wrote:
>
>
> You can create two queries from two query parser, one with AND and the
> other
> one with OR. After you create both of them, you call setBoost() to give
> different boost level and then join them together using BooleanQuery with
> option BooleanClause.Occur.SHOULD. That should do the trick.
>
>
> askarzaidi wrote:
> >
> > Hey Guys,
> >
> > Quick question:
> >
> > I do this in my code for searching:
> >
> > queryParser.setDefaultOperator(QueryParser.Operator.AND);
> >
> > Lucene is OR by default so I change it to AND for my requirements. Now,
> I
> > have a requirement to do OR as well. I mean while doing AND I'd like to
> > include results from OR too ... but they'll be much lower ranked than
> the
> > AND results.
> >
> > Is there a way to do this ?
> >
> > thanks,
> > AZ
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Do-AND-%2B-OR-Search-in-Lucene-tf4205268.html#a11962340
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message