Lucene range search using WithinRange() does not return any results

Topics: Troubleshooting, Writing modules
Jan 2, 2013 at 10:27 PM

I'm facing a problem where my range searches won't return the documents/items indexed by Lucene. I'm using Luke ( to view and debug my index and found that manually executing my query ("+Schuhgre:[7 TO 8]") returns me the one document that matches the query (with a value of 7.0) but when my SearchService executes the same query it just returns zero results.

Has anybody encountered a similar behavior before?

Jan 7, 2013 at 9:03 PM

I found the problem - and the solution.

The problem was that we're using the Type decimal for some of our searchable properties, and since Lucene does not natively support that type, at some point in the past I decided to encode those decimals as strings in the search index not to lose their precision as might happen converting decimal to double. Later, implementing the search side, I forgot that I indexed all decimal properties as strings and just converted the decimal range borders to double, which is why Lucene wouldn't find any results for those queries.

What a shot in my own knee!