Lucene hibernate search NumericRangeQuery n

2019-08-31 08:53发布

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条回答
爷、活的狠高调
2楼-- · 2019-08-31 09:44

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

查看更多
登录 后发表回答