Search code examples
indexingluceneluke

Lucene numeric range search with LUKE


I have a number of numeric Lucene indexed fields:

60000
78500
105000

If I use LUKE to query for 78500 as follows:

price:78500

It returns the correct record, however if I try to return all three record as a range I get no results.

price:[60000 TO 105000]

I realise this is due to padding as numbers are treated strings by Lucene however I just wish to know what I should be putting into LUKE to return the three records.

Many thanks for any help.


Solution

  • The solution I used for this was that the values inputted for price needed to be added to the index in padded form. Then I would just query the new padded value which works great. Therefore the new values in the index were:

    060000
    078500
    105000
    

    This solution was tied into an Examine search issue for Umbraco so there is a thread on the Forum of how to implement a numeric based range search if anyone requires this it is located here with a walk through end to end.

    Umbraco Forum Thread