lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter W. <pe...@marketingbrokers.com>
Subject Re: search with RangeFilter.Less
Date Thu, 29 Jun 2006 01:39:15 GMT
Jason,

Thanks, but changing it to '05' or '05L' in the code didn't seem to 
work,
hits.length() still returns 0 when the document should be found.

If you make just one change in the example:

       Hits hits = searcher.search(query);
       //Hits hits = searcher.search(fq);

IndexSearcher finds a match and populates the hits object. The issue 
seems to be in the
filter (which is built using RangeFilter.Less) and the FilteredQuery.

In the RangeFilter class, using 'Less' or 'More' gives you matches 
lower or higher than a set boundary:

Filter filter=RangeFilter.Less("num",NumberTools.longToString(10L));   
// field num < 10
...
FilteredQuery fq = new FilteredQuery(query,filter);

The NumberTools.longToString() method is supposed to replace padding 
leading 0's eliminating string comparison issues.

Hopefully, someone can help.

Peter W.



On Jun 28, 2006, at 5:21 PM, Jason Pump wrote:

> It's a string comparison. Make the "5" a "05" would be a simple 
> workaround.
>
> Jason


---------------------------------------------------------------------
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