将lucene-surround QueryParser部署到Solr

时间:2011-02-01 15:34:05

标签: lucene solr

我正在尝试将Lucene-surround QueryParser部署到Solr(1.4.0)

我被告知这很简单,只需下载环绕的QueryParser jar并将其添加到solr.war中的lib目录,然后通过添加行在solrconfig.xml中引用它

<queryParser name="SurroundQParser" class="org.apache.lucene.queryParser.surround.parser.QueryParser"/>

当我这样做时,我收到此错误

SEVERE: org.apache.solr.common.SolrException: Error Instantiating QParserPlugin,
 org.apache.lucene.queryParser.surround.parser.QueryParser is not a org.apache.s
olr.search.QParserPlugin
        at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:415)
        at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:435)
        at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1498)
        at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1492)
        at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1525)
        at org.apache.solr.core.SolrCore.initQParsers(SolrCore.java:1442)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:548)
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:428)
        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:278)
        at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContain
er.java:117)
        at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.ja
va:83)
        at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.ja
va:594)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.jav
a:1218)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
500)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448
)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:147)
        at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHan
dlerCollection.java:161)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:147)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
117)
        at org.mortbay.jetty.Server.doStart(Server.java:210)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
        at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:929)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.mortbay.start.Main.invokeMain(Main.java:183)
        at org.mortbay.start.Main.start(Main.java:497)
        at org.mortbay.start.Main.main(Main.java:115)

我该怎么办?

1 个答案:

答案 0 :(得分:2)

我认为你需要扩展QParserPluginThe Solr Wiki解释了 - 基本上你的createParser方法应该返回环绕查询解析器而不是QParser。 Mark Miller's post提出了一些替代方案。