Lucene休眠搜索NumericRangeQuery< Float>在使用@NumericField定义的字段上不起作用 [英] Lucene hibernate search NumericRangeQuery<Float> not working on field defined with @NumericField
问题描述
除此问题外,我使用休眠搜索4.1.0均具有良好的结果. 我正在尝试在定义的列中执行范围搜索:
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;
我存储了一个startTime = 0.0f的项目;
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();
第一:我没有结果.
第二:使用lukeall检查索引,我看到只是存储了似乎是toString()的东西(也通过其他实验判断),这看起来不正常...
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
推荐答案
Hibernate论坛首先,为了其他读者而在此处重新发布:
Replied on the Hibernate forums first, reposting here for the sake of other readers:
第一:我认为您定位的字段名错误;字段名称是startTime
,而不是startDate
.在这种情况下,由于您是直接包装Lucene查询,因此我们无法检查其有效性.
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.
秒:在卢克中看到的是Store.YES
second: what you see in Luke is the result of Store.YES
这篇关于Lucene休眠搜索NumericRangeQuery< Float>在使用@NumericField定义的字段上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!