Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

MSRP search results between given time range

Avatar

Community Advisor

Hello All,

I am trying to search for MSRP resources between given time range. I am trying to use below timeConstraint. (Made sure there are entries between that time range)

final Constraint timeConstraint = new RangeConstraint<Long>("timestamp_tl", until, cal.getTimeInMillis(), true);

"until" above is time in millis less than cal.getTimeInMillis(). Adding above timeConstraint to:

final ConstraintGroup mainConstraintGroup = new ConstraintGroup(Operator.And);

I added entries to MongoDB with additional property "timestamp_tl". Earlier I tried with just "timestamp".

In both cases I am getting error - 

07.04.2017 17:08:00.100 *ERROR* [sling-default-4727-com.mycomp.proj.core.services.Mysearch.12850] com.mycomp.proj.core.services.MySearchTest Task failed!
java.lang.UnsupportedOperationException: Decimal searches not supported yet
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.getValueStringSolr(LuceneQueryFactory.java:554)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.getValueString(LuceneQueryFactory.java:542)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.getPropertyValueQuery(LuceneQueryFactory.java:511)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.getComparisonQuery(LuceneQueryFactory.java:487)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.mapConstraintToQueryAndFilter(LuceneQueryFactory.java:316)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.mapConstraintToQueryAndFilter(LuceneQueryFactory.java:281)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.mapConstraintToQueryAndFilter(LuceneQueryFactory.java:282)
        at com.adobe.cq.social.sc.lucene.LuceneQueryFactory.getStatement(LuceneQueryFactory.java:164)
        at com.adobe.cq.social.sc.lucene.QueryObjectModelImpl.getSelectorStatement(QueryObjectModelImpl.java:168)
        at com.adobe.cq.social.sc.lucene.QueryObjectModelImpl.getStatement(QueryObjectModelImpl.java:109)
        at com.adobe.cq.social.ugc.impl.LuceneUgcSearch.findCloudResources(LuceneUgcSearch.java:959)
        at com.adobe.cq.social.ugc.impl.LuceneUgcSearch.find(LuceneUgcSearch.java:805)
        at com.adobe.cq.social.ugc.impl.LuceneUgcSearch.find(LuceneUgcSearch.java:719)
        at org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(QuartzJobExecutor.java:118)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Any suggestions on what I might be doing wrong?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello All,

I found that I need to use 

final Constraint timeConstraint = new RangeConstraint<Date>("timestamp", until, cal.getTime(), true);

Above 'until' and 'cal.getTime()' are java.util.Date objects

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello All,

I found that I need to use 

final Constraint timeConstraint = new RangeConstraint<Date>("timestamp", until, cal.getTime(), true);

Above 'until' and 'cal.getTime()' are java.util.Date objects