java - Range Query with Lucene 2.9.x - Dates in Index are not working -


i use following statement index date:

lucenedoc.add(new numericfield(key).setlongvalue(date.gettime())); 

i use statements follows add text properties:

lucenedoc.add(new field(key, value, field.store.yes, field.index.analyzed)); 

then perform text property query:

author:hans 

this works perfect. when perform range query, nothing gets returned:

my-date-property:[20100101 20110101] 

what missing here?

i had @ index luke, see text property document but date properties appear in overview page... maybe normal. see date properties if add this:

numericfield field = new numericfield(key, field.store.yes, true); field.setlongvalue(date.gettime()); lucenedoc.add(field); 

but: query still not work! maybe works java query builder? have not tried out that. great if text query work too. idea???

if want range query work dates in form of yyyymmdd, index date this:

string datestring = datetools.datetostring(date, resolution.day); lucenedoc.add(new field(key, datestring, store.yes, index.not_analyzed)); 

Comments