我正在做一个POC来使用solr搜索引擎索引pdf和word文档。我试图搜索详细的级别信息或文章,但没有得到\发现任何详细的文章来做。我发现是使用一些solr包提供的例子。这不是我要求的。
我目前掌握的信息是可以使用Solr Cell和Apache Tika索引pdf文档。
从某些利益冲突流程中,我发现链接http://wiki.apache.org/solr/ExtractingRequestHandler,但它不是教程或步骤来做我想要的。另外,我想使用solrnet从.net应用程序调用solr。
我正在使用Solr 5.1版本。
我提供的样本代码是我从solr参考文档中运行的,如下所示
bin/solr -e techproducts
它开始使用techproducts核心的示例solr实例。之后,我运行以下命令索引pdf文档。
curl "http://localhost:8983/solr/techproducts/update/extract?literal.id=doc1&commit=true" -F "myfile=@example/exampledocs/solr-word.pdf"
完美无缺。
之后我从tomcat托管的solr服务器创建了新的核心,并且我尝试运行相同的curl命令和接收器错误。 我在solrconfig.xml
中添加了以下请求处理程序代码<requestHandler name="/update/extract"
startup="lazy"
class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
<str name="lowernames">true</str>
<str name="uprefix">ignored_</str>
<!-- capture link hrefs but ignore div attributes -->
<str name="captureAttr">true</str>
<str name="fmap.a">links</str>
<str name="fmap.div">ignored_</str>
</lst>
</requestHandler>
脚本:
C:\tomcat-solr>curl "http://localhost:8090/solr/Core3/update/extract?literal.id=
doc1&commit=true" -F "myfile=@example/exampledocs/solr-word.pdf"
错误:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="error"><str name="msg">Error loading class 'solr.extraction.Extractin
gRequestHandler'</str><str name="trace">org.apache.solr.common.SolrException: Er
ror loading class 'solr.extraction.ExtractingRequestHandler'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.
java:492)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.
java:423)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:561)
at org.apache.solr.core.PluginBag$LazyPluginHolder.createInst(PluginBag.
java:343)
at org.apache.solr.core.PluginBag$LazyPluginHolder.get(PluginBag.java:32
8)
at org.apache.solr.core.PluginBag.get(PluginBag.java:130)
at org.apache.solr.handler.RequestHandlerBase.getRequestHandler(RequestH
andlerBase.java:219)
at org.apache.solr.core.SolrCore.getRequestHandler(SolrCore.java:1263)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilte
r.java:382)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilte
r.java:220)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:106)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAcce
ssLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.pr
ocess(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
int.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
t.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
read.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: solr.extraction.ExtractingRequestHa
ndler
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.
java:476)
... 27 more
</str><int name="code">500</int></lst>
</response>
我错过了什么吗?
答案 0 :(得分:0)
查看错误,似乎apache-solr-cell jar及其依赖项在Solr库的提取库中缺失。
<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../contrib/extraction/lib" />
添加这些文件......