Java Hibernate搜索带有日期属性的多字段QueryParser
我从Hibernate Search 4.4升级到5.3,并成功地迁移了中的所有问题,但在使用Java Hibernate搜索带有日期属性的多字段QueryParser,java,date,lucene,hibernate-search,Java,Date,Lucene,Hibernate Search,我从Hibernate Search 4.4升级到5.3,并成功地迁移了中的所有问题,但在使用MultiFieldQueryParser时遇到了以下有关日期属性的错误 org.hibernate.search.exception.SearchException: HSEARCH000233: The specified query '+(dateField:value)' contains a string based sub query which targets the numeric en
MultiFieldQueryParser
时遇到了以下有关日期属性的错误
org.hibernate.search.exception.SearchException: HSEARCH000233: The specified query '+(dateField:value)' contains a string based sub query which targets the numeric encoded field(s) 'myDate'. Check your query or try limiting the targeted entities.
我的约会酒店相当标准
@Column(name = "my_date")
@Temporal(TemporalType.TIMESTAMP)
@Field
@DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY)
private Date myDate;
版本
- 冬眠4.3
- HibernateSearch5.3
- 必须为
显式导入(maven)org.apache.lucene.queryparser.classic.multifielddqueryparser
(4.10.4)org.apache.lucene.lucene queryparser
myDate
声明中遗漏了什么
编辑:错过了一个迁移要求-请参阅下面我的答案。事实证明,我错过了一个迁移要求:默认情况下,在HS 5中,enconding设置为数值
编码
以模拟以前版本中的行为修复了此问题
@Column(name = "my_date")
@Temporal(TemporalType.TIMESTAMP)
@Field
@DateBridge(resolution = org.hibernate.search.annotations.Resolution.DAY, encoding = EncodingType.STRING)
private Date myDate;