Hi all,
I would like to query my index to get all data to some date. Every row has a publication date and i would like to use this date to get my results using the actual day time.
Code:
@Field
@DateBridge(resolution=Resolution.SECOND)
protected Date publicationDate = new Date();
i have read in hibernate search in action book about using rangequery to query using dates. In luke i can get the data using this query [* TO NOW] but i can not do this with hibernate search.
I tried:
Code:
andQuery.add(new TermQuery(new Term(field, "[* TO NOW]")), Occur.MUST);
i also tried:
Code:
TermRangeQuery rq = new TermRangeQuery(field, DateTools.dateToString(new Date(), DateTools.Resolution.SECOND), DateTools.dateToString(new Date(), DateTools.Resolution.SECOND),false, true);
andQuery.add(rq, Occur.MUST);
none of these solutions helps me to get the data till actual date.
any ideas?
thanks in advance!