lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warren <war...@clarksnutrition.com>
Subject Re: BooleanQuery questions
Date Thu, 04 Oct 2007 00:41:07 GMT
Thanks for the reply. Everything is working correctly now. I jumped the gun without debuging
it 
more. booleanANDSearch was not getting set correctly.

Erick Erickson wrote:
> I don't see a problem with your booleanANDSearch thingy, although
> I haven't tried it.
> 
> Does toString() return the same string regardless of the value of
> booleanANDSearch? That would surprise me. The default
> is OR, so the toString output looks like booleanANDSearch is false.
> 
> In general, the Lucene syntax is
> no symbol SHOULD
> +              MUST
> -               MUST_NOT
> 
> If this doesn't help, could you give us the toString for your
> query1 and query2?
> 
> Erick
> 
> On 10/3/07, Warren <warren@clarksnutrition.com> wrote:
>> I am new to Lucene and am having problems with booleanQueries. How do you
>> write Boolean OR and AND
>> queries?
>>
>> Is this an OR query
>>
>> booleanQuery.add(query1, BooleanClause.Occur.SHOULD);
>> booleanQuery.add(query2, BooleanClause.Occur.SHOULD);
>>
>> and is this an AND query
>>
>> booleanQuery.add(query1, BooleanClause.Occur.MUST);
>> booleanQuery.add(query2, BooleanClause.Occur.MUST);
>>
>> Is there a problem writing it this way so I can change between the two by
>> setting booleanANDSearch
>> to true or false
>>
>> booleanQuery.add(query1,(booleanANDSearch?BooleanClause.Occur.MUST:
>> BooleanClause.Occur.SHOULD));
>> booleanQuery.add(query2,(booleanANDSearch?BooleanClause.Occur.MUST:
>> BooleanClause.Occur.SHOULD));
>>
>> Also, when I call booleanQuery.toString(), I am getting this:
>>
>> (upc:creatine description:creatine content:creatine) (brand:gluten
>> brand:free) (category:alc
>> category:beer)
>>
>> It looks like each grouping is a query but how are the queries connected,
>> with AND, OR or NOT?
>>
>> --
>> Thanks,
>>
>> Warren Bell
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
> 

-- 
Thanks,

Warren Bell
Systems Administrator
Clark's Nutritional Centers
4225 Market St.
Riverside, CA 92501
951-321-1960 ext. 142
909-645-8864 mobile

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


Mime
View raw message