RE: How to build a Lucene BooleanQuery?

2016-09-21 Thread szzoli
And this works with Lucene 6.2




--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102p4297153.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



RE: How to build a Lucene BooleanQuery?

2016-09-21 Thread szzoli
Thank you.

I solved the problem so:

BooleanQuery.Builder builder = new BooleanQuery.Builder(); 

TermQuery subQuery1 = new TermQuery(new Term(field, queryString1));
TermQuery subQuery2 = new TermQuery(new Term(field, queryString2));
 
builder.add(subQuery1, BooleanClause.Occur.MUST); 
builder.add(subQuery2, BooleanClause.Occur.MUST_NOT); 

BooleanQuery bq = builder.build(); 



--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102p4297150.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



RE: How to build a Lucene BooleanQuery?

2016-09-21 Thread Uwe Schindler
Hi,

Lucene 6 does not have this possibility anymore, the constructor was deprecated 
in 5.x. You have to use the builder, see the other e-mail by Oliver Kaleske.

Uwe

-
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -Original Message-
> From: Chaitanya Kumar Ch [mailto:chaitu381...@gmail.com]
> Sent: Wednesday, September 21, 2016 1:20 PM
> To: java-user@lucene.apache.org
> Subject: Re: How to build a Lucene BooleanQuery?
> 
> I am able to create BooleanQuery using
> BooleanQuery categoryQuery = new BooleanQuery();
> 
> I don't understand why you said it does not exist.
> 
> On Wed, Sep 21, 2016 at 4:39 PM, szzoli <reg9sz...@freemail.hu> wrote:
> 
> > Thank you.
> >
> > This is almost the solution, but how can I build a BoolesanQuery?
> > The
> > BooleanQuery categoryQuery = new BooleanQuery();
> > does not exist, the
> > builder.createBooleanQuery(field, queryString);
> > creats a TermQuery.
> >
> >
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.
> > nabble.com/How-to-build-a-Lucene-BooleanQuery-
> tp4297102p4297106.html
> > Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >
> > -
> > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> > For additional commands, e-mail: java-user-h...@lucene.apache.org
> >
> >
> 
> 
> --
> Thank You,
> Chaitanya Kumar Ch,
> +91 9550837582


-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



Re: How to build a Lucene BooleanQuery?

2016-09-21 Thread Chaitanya Kumar Ch
I am able to create BooleanQuery using
BooleanQuery categoryQuery = new BooleanQuery();

I don't understand why you said it does not exist.

On Wed, Sep 21, 2016 at 4:39 PM, szzoli  wrote:

> Thank you.
>
> This is almost the solution, but how can I build a BoolesanQuery?
> The
> BooleanQuery categoryQuery = new BooleanQuery();
> does not exist, the
> builder.createBooleanQuery(field, queryString);
> creats a TermQuery.
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102p4297106.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>


-- 
Thank You,
Chaitanya Kumar Ch,
+91 9550837582


Re: How to build a Lucene BooleanQuery?

2016-09-21 Thread szzoli
Thank you.

This is almost the solution, but how can I build a BoolesanQuery?
The 
BooleanQuery categoryQuery = new BooleanQuery();
does not exist, the
builder.createBooleanQuery(field, queryString);
creats a TermQuery.




--
View this message in context: 
http://lucene.472066.n3.nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102p4297106.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



Re: How to build a Lucene BooleanQuery?

2016-09-21 Thread Chaitanya Kumar Ch
May be it
helps
you.

On Wed, Sep 21, 2016 at 4:11 PM, szzoli  wrote:

> Hi,
>
> I would like to build a BooleanQuery. This migt be simple, but I cannot
> find
> the way how to do it.
> It is also silly that the function
> builder.createBooleanQuery(field, queryString, BooleanClause.Occur.MUST);
> builds a TermQuery.
>
> How can I bild such a query like
> "fox MUST dog MUST_NOT" ?
>
> TIA
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>


-- 
Thank You,
Chaitanya Kumar Ch,
+91 9550837582