Lucene hibernate search NumericRangeQuery<Float> not working on field defined with @NumericField

北城余情 提交于 2019-12-11 20:08:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!