lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Bug in TestPhrasePrefixQuery in 2003.04.21 Build?
Date Thu, 01 May 2003 00:39:21 GMT
Hello,

Yes, that is a bug.  Good eyes!  The fix is coming.

Otis

--- David Medinets <medined@mtolive.com> wrote:
> The TestPhrasePrefixQuery looks like it is searching for "blueberry
> pi*" and it even seems to work at first glance. However, the test
> data is not extensive enough to show what is really happening.
> 
> The searching technique implemented in TestPhrasePrefixQuery will
> find not only "blueberry pie" but also "blueberry strudel" if both
> exist in the documents.
> 
> The reason is that the IndexReader.terms(Term termToMatch) method
> looks for the first term equal or larger than termToMatch and then
> returns *all* terms from that point in the index to the end.
> 
> One potential solution might be something like the following:
> String pattern = "pi*";
> TermEnum te = ir.terms(new Term("body", pattern));
> while (te.term().text().matches(pattern)) {
>     termsWithPrefix.add(te.term());
>     if (te.next() == false)
>         break;
>     }
> }
> 
> Of course, the code above only works with JDK1.4 because of the
> pattern matching.
> 
> Comments?
> 
> David Medinets
> Quality = Resource Multiplication
> http://www.codebits.com
> 
> 


__________________________________
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


Mime
View raw message