解决[问题]中描述的问题:Solr: where to store additional information? 我写了一个函数termcnt(fieldname),它只计算文档中有关指定字段名的特定术语 在“Solr / Lucene Statement”中使用solr管理页面(http://localhost:8080/admin/form.jsp)我查询了:
fq={!frange l=3 u=1000}termcnt(wc_text)
并收到错误:
type Status report
message org.apache.lucene.queryParser.ParseException: Cannot parse 'fq={!frange l=3 u=1000}termcnt(wc_text)': Encountered " <RANGEEX_GOOP> "u=1000 "" at line 1, column 16. Was expecting: "}" ...
description The request sent by the client was syntactically incorrect (org.apache.lucene.queryParser.ParseException: Cannot parse 'fq={!frange l=3 u=1000}termcnt(wc_text)': Encountered " <RANGEEX_GOOP> "u=1000 "" at line 1, column 16. Was expecting: "}" ... ).
我的错误在哪里?
谢谢
P.S。当我在等待时:
_val_:"termcnt(wc_text)"
我的功能正常......
P.P.S即使使用sum func我也有相同的结果:(
fq={!frange l=3 u=1000}sum(2,3)
solr 3.2.0
lucene 3.2.0
(来自maven存储库)
堆栈跟踪(根据要求):
1 jul 2011 9:33:39 org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: Cannot parse 'fq={!frange l=3 u=100000}termcnt(wc_text)': Encountered " <RANGEEX_GOOP> "u=100000 "" at line 1, column 16.
Was expecting:
"}" ...
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:108)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:286)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:272)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1730)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.lucene.queryParser.ParseException: Cannot parse 'fq={!frange l=3 u=100000}termcnt(wc_text)': Encountered " <RANGEEX_GOOP> "u=100000 "" at line 1, column 16.
Was expecting:
"}" ...
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:211)
at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:80)
at org.apache.solr.search.QParser.getQuery(QParser.java:142)
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:84)
... 21 more
Caused by: org.apache.lucene.queryParser.ParseException: Encountered " <RANGEEX_GOOP> "u=100000 "" at line 1, column 16.
Was expecting:
"}" ...
at org.apache.lucene.queryParser.QueryParser.generateParseException(QueryParser.java:1818)
at org.apache.lucene.queryParser.QueryParser.jj_consume_token(QueryParser.java:1700)
at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1510)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1309)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1266)
at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1226)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
... 24 more
1 jul 2011 9:33:39 org.apache.solr.core.SolrCore execute
INFO: [] webapp= path=/select params={explainOther=&fl=&indent=on&start=0&q=fq%3D{!frange+l%3D3+u%3D100000}termcnt(wc_text)&hl.fl=&qt=&wt=&fq=&rows=10&version=2.2} status=400 QTime=21
答案 0 :(得分:0)
我认为界面已经有所改变,因为这是写的 - 但是你的查询
fq={!frange l=3 u=1000}sum(2,3)
似乎写得正确。您可以尝试对其进行网址编码,例如
fq=%7B!frange+l%3D3+u%3D1000%7Dsum(2%2C3)
但我觉得这个问题只是从较新版本的Solr和管理面板中解决了。