Range query giving wrong results
Entity class:
@Field
@Column(name="VALID_FROM")
private Date validFrom;
@Field
@Column(name="VALID_TO")
private Date validTo;
Query startDateQuery = queryBuilder.range().onField("validFrom").above(java.sql.Date.valueOf(LocalDate.of(2020, 4, 7))).createQuery();
Query endDateQuery = queryBuilder.range().onField("validTo").below(java.sql.Date.valueOf(LocalDate.of(2020, 4, 14))).createQuery();
queryBuilder.bool().should(startDateQuery ).must(endDateQuery).createQuery();
It should return the results which are in the range(from 2020-4-7 to:2020-4-14) but the above query returning results like record(from:14-MAY-20 to:16-JUL-20)
and record(from:01-APR-20 to:07-APR-20) which are not in the range.
Note: I also want to return the overlap dates results as well e.g record(from:13-APR-20 to:18-JUN-20) should also return.