With the DatePointField you can still do the range query, but I believe
you'll need to specify the full ISO date string: 2000-05-01T01:01:01Z

Joel Bernstein
http://joelsolr.blogspot.com/


On Thu, Dec 12, 2019 at 6:46 AM Mel Mason <mel.ma...@bodleian.ox.ac.uk>
wrote:

> Unfortunately I need a date range field, e.g [2000-05-01 TO 2019-06-02].
> DatePointFields can't represent that as far as I know.
>
> On 12/12/2019 11:40, Joel Bernstein wrote:
> > There is a field type in the schema called pdate:
> >
> > <fieldType name="pdate" class="solr.DatePointField" docValues="true"/>
> >
> > This should work for you.
> >
> > The timeseries Streaming Expression uses the JSON facet API for range
> > faceting and works really well.
> >
> >
> >
> >
> > Joel Bernstein
> > http://joelsolr.blogspot.com/
> >
> >
> > On Thu, Dec 12, 2019 at 6:28 AM Mel Mason <mel.ma...@bodleian.ox.ac.uk>
> > wrote:
> >
> >> Hi,
> >>
> >> I'm trying to have a range facet on a field of type solr.DateRangeField.
> >> As far as I can tell, this isn't possible with JSONFacet, only with the
> >> old facet system - a quick google turns up several other people with the
> >> same problem. When using JSONFacet I get problems with this line of
> >> code:
> >>
> >>
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/search/facet/FacetRange.java#L255
> >>
> >> It looks like during the change to JSONFacet the range facets have been
> >> restricted to only allow Trie or PointField fields. Is this likely to be
> >> fixed in future updates, or were there problems with using
> >> DateRangeFields? I could use the old parameter facet system, but there
> >> are features in JSONFacet I need.
> >>
> >> For completeness, the error I get:
> >>
> >> org.apache.solr.common.SolrException: Unable to range facet on
> >> field:date_dtr
> >>          at
> >>
> org.apache.solr.search.facet.FacetRangeProcessor.getCalcForField(FacetRange.java:238)
> >>          at
> >>
> org.apache.solr.search.facet.FacetRangeProcessor.<init>(FacetRange.java:122)
> >>          at
> >>
> org.apache.solr.search.facet.FacetRange.createFacetProcessor(FacetRange.java:65)
> >>          at
> >> org.apache.solr.search.facet.FacetRequest.process(FacetRequest.java:397)
> >>          at
> >>
> org.apache.solr.search.facet.FacetProcessor.processSubs(FacetProcessor.java:475)
> >>          at
> >>
> org.apache.solr.search.facet.FacetProcessor.fillBucket(FacetProcessor.java:432)
> >>          at
> >>
> org.apache.solr.search.facet.FacetQueryProcessor.process(FacetQuery.java:64)
> >>          at
> >> org.apache.solr.search.facet.FacetRequest.process(FacetRequest.java:401)
> >>          at
> >> org.apache.solr.search.facet.FacetModule.process(FacetModule.java:146)
> >>          at
> >>
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:298)
> >>          at
> >>
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
> >>          at org.apache.solr.core.SolrCore.execute(SolrCore.java:2566)
> >>          at
> >> org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:756)
> >>          at
> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:542)
> >>          at
> >>
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:397)
> >>          at
> >>
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:343)
> >>          at
> >>
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
> >>          at
> >>
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
> >>          at
> >>
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
> >>          at
> >>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
> >>          at
> >>
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
> >>          at
> >>
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
> >>          at
> >>
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
> >>          at
> >>
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
> >>          at
> >>
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> >>          at
> >>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> >>          at
> >>
> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
> >>          at
> >>
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
> >>          at org.eclipse.jetty.server.Server.handle(Server.java:502)
> >>          at
> >> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
> >>          at
> >>
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
> >>          at org.eclipse.jetty.io
> >> .AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
> >>          at org.eclipse.jetty.io
> >> .FillInterest.fillable(FillInterest.java:103)
> >>          at org.eclipse.jetty.io
> >> .ChannelEndPoint$2.run(ChannelEndPoint.java:118)
> >>          at
> >>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
> >>          at
> >>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
> >>          at
> >>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
> >>          at
> >>
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
> >>          at
> >>
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
> >>          at
> >>
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
> >>          at
> >>
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
> >>          at java.lang.Thread.run(Thread.java:748)
> >>
> >> Thanks,
> >>
> >> --
> >> Mel Mason
> >> Software Engineer
> >> Bodleian Digital Library Systems and Services
> >> Osney One
> >> Mon-Thurs
> >>
> >> 01865 280031
> >> mel.ma...@bodleian.ox.ac.uk
> >>
> >>
>

Reply via email to