From dev-return-354528-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Wed May 1 04:39:08 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3C22A180651 for ; Wed, 1 May 2019 06:39:08 +0200 (CEST) Received: (qmail 6873 invoked by uid 500); 1 May 2019 04:39:06 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 6863 invoked by uid 99); 1 May 2019 04:39:06 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2019 04:39:06 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 67546E036B for ; Wed, 1 May 2019 04:39:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1CDDD20FEB for ; Wed, 1 May 2019 04:39:00 +0000 (UTC) Date: Wed, 1 May 2019 04:39:00 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LUCENE-8787) DateRangeField does not accept ISO 8601 date/time strings with more ore less than 3 decimal places MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-8787?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D168= 30855#comment-16830855 ]=20 ASF subversion and git services commented on LUCENE-8787: --------------------------------------------------------- Commit ec9132d9e0fe599f414565874b21a70459e36b90 in lucene-solr's branch ref= s/heads/branch_8x from Thomas Lemm=C3=A9 [ https://gitbox.apache.org/repos/asf?p=3Dlucene-solr.git;h=3Dec9132d ] LUCENE-8787: DateRangePrefixTree now parses milliseconds when num digits != =3D 3 (cherry picked from commit 424558ff880d9b9489472d37c80fe5bb2fae6fa5) > DateRangeField does not accept ISO 8601 date/time strings with more ore l= ess than 3 decimal places > -------------------------------------------------------------------------= ------------------------- > > Key: LUCENE-8787 > URL: https://issues.apache.org/jira/browse/LUCENE-8787 > Project: Lucene - Core > Issue Type: Improvement > Affects Versions: 8.0 > Environment: Solr running=C2=A0solr:7.7-alpine Docker image > Reporter: Thomas Lemm=C3=A9 > Assignee: David Smiley > Priority: Major > Attachments: LUCENE-8773.patch, LUCENE-8773.patch, LUCENE-8773.pa= tch > > > *Context*: Solr running=C2=A0solr:7.7-alpine Docker image > *Steps to reproduce:* > * create a DateRangeField field type=C2=A0 > {{}} > * add a field to the schema: > {{}} > * start & populate the core > * Query the core with a filter query on the DateRangeField: > /select?&q.alt=3D*&defType=3Ddismax&fq=3D{!field f=3DopeningHoursDates op= =3DContains}[2019-04-21T12:34:56.100Z TO=C2=A0*2019-04-21T12:34:56.1Z*] > *Expected:* > * Solr returns matching documents > *Actual:* > * ParseException is thrown & Solr returns Message=C2=A0"Couldn't parse d= ate because: Improperly formatted datetime: 2019-04-21T12:34:56.1Z" > =C2=A0 > The timestamp has been created using=C2=A0DateTimeFormatter.ISO_DATE_TIME= . I=C2=A0guess=C2=A0Solr should support Strings generated with the java dat= etime API. > =C2=A0 > *Stacktrace*: > {noformat} > 2019-04-19 09:00:14.670 ERROR (qtp1543148593-18) [ x:snpindex] o.a.s.h.Re= questHandlerBase org.apache.solr.common.SolrException: Couldn't parse date = because: Improperly formatted datetime: 2019-04-21T12:34:56.1Z > at org.apache.solr.schema.DateRangeField.parseShape(DateRangeField.java:1= 00) > at org.apache.solr.schema.DateRangeField.parseSpatialArgs(DateRangeField.= java:134) > at org.apache.solr.schema.AbstractSpatialFieldType.getFieldQuery(Abstract= SpatialFieldType.java:340) > at org.apache.solr.search.FieldQParserPlugin$1.parse(FieldQParserPlugin.j= ava:45) > at org.apache.solr.search.QParser.getQuery(QParser.java:173) > at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponen= t.java:207) > at org.apache.solr.handler.component.SearchHandler.handleRequestBody(Sear= chHandler.java:272) > at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandle= rBase.java:199) > at org.apache.solr.core.SolrCore.execute(SolrCore.java:2551) > at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:710) > at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:516) > at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter= .java:395) > at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter= .java:341) > at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletH= andler.java:1602) > at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:= 540) > at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.ja= va: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(ScopedHandle= r.java:257) > at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandle= r.java:1588) > at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandle= r.java:255) > at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandle= r.java:1345) > at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler= .java:203) > at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:4= 80) > 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.ja= va:144) > at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(Conte= xtHandlerCollection.java:220) > at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerColle= ction.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(Abstrac= tConnection.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(EatWhatY= ouKill.java:333) > at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWha= tYouKill.java:310) > at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWh= atYouKill.java:168) > at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKi= ll.java:126) > at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.ru= n(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) > Caused by: java.text.ParseException: Improperly formatted datetime: 2019-= 04-21T12:34:56.1Z > at org.apache.lucene.spatial.prefix.tree.DateRangePrefixTree.parseCalenda= r(DateRangePrefixTree.java:512) > at org.apache.lucene.spatial.prefix.tree.DateRangePrefixTree.parseUnitSha= pe(DateRangePrefixTree.java:431) > at org.apache.lucene.spatial.prefix.tree.NumberRangePrefixTree.parseShape= (NumberRangePrefixTree.java:188) > at org.apache.solr.schema.DateRangeField.parseShape(DateRangeField.java:9= 7) > ... 46 more > Caused by: java.lang.StringIndexOutOfBoundsException: String index out of= range: 23 > at java.lang.String.substring(String.java:1963) > at org.apache.lucene.spatial.prefix.tree.DateRangePrefixTree.parseCalenda= r(DateRangePrefixTree.java:507) > ... 49 more > snpindex_1 | > 2019-04-19 09:00:14.670 INFO (qtp1543148593-18) [ x:snpindex] o.a.s.c.S.R= equest [snpindex] webapp=3D/solr path=3D/select params=3D{q.alt=3D*&defType= =3Ddismax&fq=3D{!field+f%3DopeningHoursDates+op%3DContains}[2019-04-21T12:3= 4:56.100Z+TO+2019-04-21T12:34:56.1Z]} status=3D400 QTime=3D5{noformat} > *Solution*: > The misconception in the current code is that it parses "milliseconds" bu= t it's actually the decimal places of seconds. > I modified the parser to parse as many decimal places as available. The r= esult is then normalized to milliseconds to fit the Java Calendar implement= ation. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org