我正在尝试在给定时间范围内搜索MSRP资源。我想在timeConstraint下使用。 (确保在该时间范围之间有条目)
final Constraint timeConstraint = new RangeConstraint<Long>("timestamp_tl", until, cal.getTimeInMillis(), true);
“until”以上是millis的时间小于cal.getTimeInMillis()。将以上timeConstraint添加到:
final ConstraintGroup mainConstraintGroup = new ConstraintGroup(Operator.And);
我使用附加属性“timestamp_tl”向MongoDB添加了条目。早些时候我尝试过“时间戳”。
在这两种情况下我都会收到错误 -
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 :(得分:0)
我发现我需要使用
final Constraint timeConstraint = new RangeConstraint<Date>("timestamp", until, cal.getTime(), true);
以上&#39;直到&#39;和&#39; cal.getTime()&#39;是java.util.Date对象。我正在假设&#34;时间戳&#34; MongoDB中保存的值是&#34; long&#34;值,因为它显示为"NumberLong("1492006094509")"