You posted this already?
Hm, must have missed it.  I had half a dozen beers ;), but this look
good.  You don't need those outter parenthesis.  Provide a
self-enclosing demonstration class, please, or a URL to your message if
it you already sent a message containing it.

Otis

--- Michael Caughey <[EMAIL PROTECTED]> wrote:
> Part of my problem seems to be that the Range Query Object isn't
> acting as it should as per the FAQ and other mail list entries.
> I'm using Lucene 1.2
> 
> I have a field in my index called DATE.  I'd like to do a date range
> search on it. I am using Strings in the format of yyyyMMdd.
> 
> I have the following dates in my Index:
> 20021105
> 20021126
> 20021113
> 20021115
> 20021103
> 20021125
> 
> 
> When I use the follwing code to search, I get an exception:
> *NOTE: I'm using the MultiFieldQueryParser becuase In some cases I
> check other field, I've simplified this one to demonstrate (and run
> my tests isolated from other factors)
> 
>        IndexSearcher search = new IndexSearcher("myindex");
>        SimpleAnalyzer analyzer = new SimpleAnalyzer();
>        String[] fields = new String[1];
>        fields[0] = "DATE"
>         
>       String buff = "( DATE:[20021101 - 20021131] )";
>       Query query = MultiFieldQueryParser.parse(buff, fields,
> analyzer);
>       searcher.search(query);
> 
> I get the following error:
> java.lang.IllegalArgumentException: At least one term must be
> non-null
> 
> if buff = "( DATE:20021101 - 20021131 )";
> as well as
> if buff = "( DATE:(20021101 - 20021131 ))";
> I simply get no results.
> 
> I have added the date to the document by both
> Field.Text("DATE", dateStr);
> and
> Field.Keyword("DATE", dateStr);
> 
> I have also tried to build the queries up creating Objects.  One of
> the things I notice is that if I use the RangeQuery Object there are
> no spaces on either side of the "-".
> 
> The documents which I created have the following Fields:
> TITLE, DESCRIPTION and DATE.
> If I search on TITLE or DESCRIPTION or a combination of both I get
> results just fine.
> 
> Am I doing something stupid, or is this a bug?  Seems to based on
> what I read that the example above where String buff = "(
> DATE:[20021101 - 20021131] )"; is correct and should work.
> 
> I published the complete source in an earlier posting called "Problem
> with Range".  It also contains a stack trace of the error.
> 
> Thanks in advance,
> Michael
> 
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to