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 "Ramrakhiani, Vikas" <Vi...@deshaw.com> on 2003/04/16 08:07:38 UTC

Unable to change default boolean operator to AND

I was trying to implement default boolean operator AND in the demo code
SearchFiles.java.
I did the following :-

        QueryParser qp = new QueryParser("contents", analyzer);
        System.out.println("Value for AND operator is: " + 
                           qp.DEFAULT_OPERATOR_AND);
        qp.setOperator(1);
	Query query = qp.parse(line, "contents", analyzer);
        System.out.println("Query is " + query);
	System.out.println("Searching for: " + query.toString("contents"));
        System.out.println("Operator is: " + qp.getOperator());

But what I get is still the default OR opertor:

Query: asd asd 
Value for AND operator is: 1
Query is contents:asd contents:asd
Searching for: asd asd
Operator is: 1

What am I doing wrong ?

thanks for your help,
vikas. 

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Unable to change default boolean operator to AND

Posted by Dario Dentale <da...@portalis.it>.
I tryied in this way with lucene-1.3-rc1, but doesn't work: it use always OR
operator.
It is a bug or I'm wrong?

Thanx,
Dario

----- Original Message ----- 
From: "Otis Gospodnetic" <ot...@yahoo.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Wednesday, April 16, 2003 8:17 AM
Subject: Re: Unable to change default boolean operator to AND


> qp.setOperator(QueryParser.DEFAULT_OPERATOR_AND);
>
> --- "Ramrakhiani, Vikas" <Vi...@deshaw.com> wrote:
> > I was trying to implement default boolean operator AND in the demo
> > code
> > SearchFiles.java.
> > I did the following :-
> >
> >         QueryParser qp = new QueryParser("contents", analyzer);
> >         System.out.println("Value for AND operator is: " +
> >                            qp.DEFAULT_OPERATOR_AND);
> >         qp.setOperator(1);
> > Query query = qp.parse(line, "contents", analyzer);
> >         System.out.println("Query is " + query);
> > System.out.println("Searching for: " + query.toString("contents"));
> >         System.out.println("Operator is: " + qp.getOperator());
> >
> > But what I get is still the default OR opertor:
> >
> > Query: asd asd
> > Value for AND operator is: 1
> > Query is contents:asd contents:asd
> > Searching for: asd asd
> > Operator is: 1
> >
> > What am I doing wrong ?
> >
> > thanks for your help,
> > vikas.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo
> http://search.yahoo.com
>


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Unable to change default boolean operator to AND

Posted by Otis Gospodnetic <ot...@yahoo.com>.
qp.setOperator(QueryParser.DEFAULT_OPERATOR_AND);

--- "Ramrakhiani, Vikas" <Vi...@deshaw.com> wrote:
> I was trying to implement default boolean operator AND in the demo
> code
> SearchFiles.java.
> I did the following :-
> 
>         QueryParser qp = new QueryParser("contents", analyzer);
>         System.out.println("Value for AND operator is: " + 
>                            qp.DEFAULT_OPERATOR_AND);
>         qp.setOperator(1);
> 	Query query = qp.parse(line, "contents", analyzer);
>         System.out.println("Query is " + query);
> 	System.out.println("Searching for: " + query.toString("contents"));
>         System.out.println("Operator is: " + qp.getOperator());
> 
> But what I get is still the default OR opertor:
> 
> Query: asd asd 
> Value for AND operator is: 1
> Query is contents:asd contents:asd
> Searching for: asd asd
> Operator is: 1
> 
> What am I doing wrong ?
> 
> thanks for your help,
> vikas. 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org