I'm trying to find if the expiry date falls between today and another date specified. Though my database has results, the search query doesn't seem to fetch the value. Please help!
This is the query that's being run: jpaQuery: FullTextQueryImpl(+membershipStatus:full_member +accountManager.firstName:nikki +expiryDate:[20190416 TO 20190516})
Also, database has expiry date in YYYY-MM-dd HH:mm:ss format, not sure how to match the fields.
This is the query:
Query expiringInQuery = queryBuilder
.range()
.onField("expiryDate")
.ignoreFieldBridge()
.from(DateTools.dateToString(today, DateTools.Resolution.DAY))
.to(DateTools.dateToString(expiringDate, DateTools.Resolution.DAY))
.excludeLimit()
.createQuery();
This is on the entity:
@Field
@Column(name = "expiryDate")
@Temporal(TemporalType.TIMESTAMP)
@JsonIgnore
@IndexedEmbedded
@DateBridge(resolution=org.hibernate.search.annotations.Resolution.DAY, encoding = EncodingType.STRING)
private Date expiryDate;