lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <carl...@bookandhammer.com>
Subject Re: Not getting any results from query
Date Sat, 16 Nov 2002 23:29:25 GMT
Hi Rob,

I don't know if you already know this, but you can use the query syntax

field1:value AND field2:value2 OR field2:value3

Depending on your desired results you may want to put parens around the 
appropriate grouping of terms.

To search for multiple terms in the same field you can use


field1:(value OR value3) AND field2:value2

This will look for both value or value3 in field1

If you are looking for a phrase

field1:"Test reliability"

will also search for the two words (next to each other) in field1.

I hope this helps clarify what the queryParser can do.

--Peter



On Friday, November 15, 2002, at 05:40 AM, Rob Outar wrote:

> That is exactly what is happening, I was using the QueryParser class 
> because
> I wanted to do stuff like this:
>
> field1 = value and field2 = value2 or field2 = value3
>
> But from what you are telling me I cannot use the Query Parser class 
> because
> it tokenizes my queries?  Do I need to use a different analyzer?
>
> The classes that extend Query I don't believe I can use because you 
> cannot
> specify and and or's for those queries.  The MultiTermQuery class I do 
> not
> believe I can specify and and or's for the various terms.
>
> Thanks for all the answers, as always any help is appreciated,
>
> Rob




>
> -----Original Message-----
> From: Ype Kingma [mailto:ykingma@xs4all.nl]
> Sent: Thursday, November 14, 2002 2:52 PM
> To: Lucene Users List
> Subject: Re: Not getting any results from query
>
>
> On Thursday 14 November 2002 19:36, you wrote:
>> Hello all,
>>
>> 	I am storing the field in this fashion:
>>
>> 	          doc.add(new Field("releaseability", releaseability, true, 
>> true,
>> false));
>>
>> 	so it is indexed and stored but not tokenized.
>>
>> 	The value is "Test Releaseability";
>>
>> 	I am using the query releaseability:test releaseability
>>
>> 	I am not getting any results, is my query wrong?
>
> Yes.
> The field is indexed, but not tokenized. That means that the
> value of the field will be indexed as given: "Test Releaseability".
> To query this, you need to make sure that the queried value is
> not tokenized either, ie. the query should not use an analyzer
> for the field values.
> The space in the field value conflicts with the query parser, ie.
> you can't use a parsed query to query a value containing a space.
>
> However, in case your query analyzer does not put values in lower case
> this query should match:
>
> releaseability:Test*
>
> Lots of fun here: spaces, query analyzers, query parsers, upper/lower 
> case,
> and truncation.
>
> You'll have to construct the query yourself in case you want to query 
> with
> the whole string "Test Releaseability".
>
> Regards,
> Ype
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:lucene-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message