I have a CustomPojo where I have a date field(testDate) in it. Now I want to search this CustomPojo's based on the date range of that date field. Am trying to achieve it in following way but unfortunately it is not filtering the data but returning all pojos. Any suggestions please.
*PojoRepository<CustomPojo, Long> customPojoRepo= getDbClient()
.newPojoRepository(CustomPojo.class, Long.class);
PojoQueryBuilder<CustomPojo> qb = customPojoRepo.getQueryBuilder();
StructuredQueryDefinition sqdef=
qb.and(qb.range("testDate", PojoQueryBuilder.Operator.GE, startCal.getTime()),
qb.range("testDate", PojoQueryBuilder.Operator.LE, endCal.getTime()));
PojoPage<CustomPojo> matchingObjs =
customPojoRepo.search(sqdef,
start);*
Thanks, Jagan
Could you post the definition of CustomPojo, and a sample of the JSON doc which is stored in the db. The definition of PojoRepository (as documented) is intended for simple CRUD methods, in particular the exact serialiation (data mapping) from your Pojo to JSON is undefined. Using queries you need to know the serialized name of the field as ML does not know anything about java. Also a range index is typed, without the definition of the range index, the Pojo, the JSON and endCal.getTime() It’s not possible to detetermine which of the most likely issues you are having.