lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: query
Date Thu, 22 Apr 2004 03:40:10 GMT
On Apr 21, 2004, at 12:17 PM, Rosen Marinov wrote:
>> Short answer: it depends.
>>
>> Questions for you to answer:
>> What field type and analyzer did you use during indexing?  What
>> analyzer used with QueryParser?  What does the generated 
>> Query.toString
>> return?
>
> in both cases SimpleAnalyzer
> QueryParser.parse("\"abc\"") throws an exception and i can't see what 
> does
> Query.toString return in this case

This is clean and green for me:

   public void testAbc() throws ParseException {
     Query query = QueryParser.parse("\"abc\"", "field", new 
SimpleAnalyzer());
     assertEquals("abc", query.toString("field"));
   }

Either you're using an old version of Lucene that is broken in this 
regard (I'm at CVS HEAD) or something else is fishy.

Note that a single term in quotes is optimized into a TermQuery, not a 
quoted PhraseQuery in the assert above.

> what analizer should i use if i want to execute folowing queries:
>    simple key word seach (+bush -president , etc)
>    range queries including " characters in searching values

Ranges with spaces in them doesn't work.  It is for single term ranges, 
not phrases that were tokenized.  If you indexed the entire "phrase" as 
a single term (Field.Keyword), then you could do an API RangeQuery, but 
QueryParser won't be happy.

QueryParser syntax is documented on the Lucene website if you need 
assistance with the type of syntax it supports.

	Erik


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


Mime
View raw message