问题
I use hibernate search 4.1.0 with good results except for this problem. I´m trying to perform a range search in a column defined:
@Field(name = "startTime", store = Store.YES)
@NumericField
public Float startTime;
I have stored an item with startTime = 0.0f;
then I try to perform a range query:
NumericRangeQuery<Float> rangeQuery = NumericRangeQuery.newFloatRange(
"startDate", -100000.0f, +100000.0f, true, true);
FullTextQuery fullTextQuery = fullTextEntityManager
.createFullTextQuery(rangeQuery, Item.class);
results = fullTextQuery.getResultList();
First: I have no results.
Second: Inspecting the index with lukeall, I see simply stored what seems to be the toString() [judging by other experiments too], which looks not normal...
I feel like I´m missing something, any help would be appreciated. Thanks
回答1:
Replied on the Hibernate forums first, reposting here for the sake of other readers:
first: I think you're targeting the wrong field name; the field name is startTime
, not startDate
. In this case since you are wrapping a Lucene Query directly we can't check for it's validity.
second: what you see in Luke is the result of Store.YES
来源:https://stackoverflow.com/questions/11225552/lucene-hibernate-search-numericrangequeryfloat-not-working-on-field-defined-wi