lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon <>
Subject indexing and searching real numbers
Date Thu, 05 Apr 2007 17:38:14 GMT

Hello everybody,

I need to index and search real numbers in Lucene. I found NumberUtils class
in Solr project which permits one to encode doubles into string so that
alpha numeric ordering would correctly correspond to the ordering on
numbers. When I use ConstantScoreRangeQuery programmatically everything
works just fine. However when I convert this query to a string, parse it
with QueryParser and use the resulting query – no result are found.

ConstantScoreRangeQuery wquery = 
  new ConstantScoreRangeQuery("westbc", null,
NumberUtils.double2sortableStr(-110.500000), false, true);
Hits hits =; //returns expected results

Now if I do

String wqueryString = wquery.toString();
QueryParser queryParser = new QueryParser("westbc", new KeywordAnalyzer());
Query query = queryParser.parse(wqueryString);
Hits hits =; // returns nothing

Interesting is that System.out.println(wquery.toString()) looks exactly the
same as System.out.println(query.toString()).

Any ideas welcome.


View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message