2

我正在尝试进行日期范围查询,但我总是遇到同样的错误。问题是当我将 + 字符添加到日期范围时

请求:

http://192.168.10.202:8080/solr/PageRequests/select/?q=request_datetime:[2011-09-01T00:21:57Z TO 2011-09-01T01:21:57Z+1HOUR]&version=2.2&start=0&rows=10&indent=on

和堆栈跟踪:

at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(    ApplicationFilterChain.java:243)    
at org.apache.catalina.core.Appl    icationFilterChain.doFilter(Applicat    ionFilterChain.    java:210)    
at org.ap    ache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.    java:225)    
at org.ap    ache.catalina.core.StandardContextValve.invoke(StandardContextValve.    java:169)    
at org.ap    ache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.    java:472)    
at org.ap    ache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.ap    ache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.ap    ache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.ap    ache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.ap    ache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.ap    ache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.    java:999)    
at org.ap    ache.coyote.AbstractProtocol$AbstractConnectionHandler.process(    AbstractP    rotocol.java:565)    
at org.ap    ache.tomcat.util.    net.JIoEndpoint$SocketProcessor.run(JIoEndpoin    t.java:307)
at java.u    til.concurrent.Th    readPoolExecutor.runWorker(ThreadPoolExecutor.    java:1110)
at java.u    til.concurrent.Th    readPoolExecutor$Worker.run(ThreadPoolExecutor    .java:603)
at java.l    ang.Thread.run(Th    read.java:679)    
Caused by    : org.apache.luce    ne.queryParser    .ParseException: Cannot parse     'request_datetime:[2011-09-01T00:21:57Z TO 2011-09-01T01:21:57Z 1HOUR]    ':     Encounter    ed " <RANGEIN_GOO    P> "1HOUR "" a    t line 1, column 63.    
Was expec    ting:    
"]" ...    

at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
at org.apache.solr.search.QParser.getQuery(QParser.java:143)
4

1 回答 1

4

由于您以这种方式调用 Solr,因此您必须使其成为+URL 编码,即替换为%2B.

于 2012-05-16T16:41:54.753 回答