2017-04-12 82 views
0

我正在尝试搜索给定时间范围之间的MSRP资源。我正在尝试使用timeConstraint。 (确信有该时间范围之间的条目)AEM 6.2- MongoDB:给定时间范围之间的MSRP搜索结果

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

“直到”以上是在毫秒时间()时间小于cal.getTimeInMillis。将上面的timeConstraint添加到:

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

我向MongoDB中添加了具有附加属性“timestamp_tl”的条目。早些时候,我试着用“时间戳”。

在这两种情况下,我得到的错误 -

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) 

什么我可能是做错了什么建议?

感谢

回答

0

我发现我需要使用

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

上面的 '直到' 和 'cal.getTime()' 是java.util.Date对象。我假设在MongoDB中保存的“时间戳”值是“long”值,因为它显示为"NumberLong("1492006094509")"