0
votes

I am doing a POC to index pdf and word documents using solr search engine. I tried to search about detailed level information or articles but did not get\found any detailed article to do it. What I found is to use some solr package provided example. That is not I require.

Current information I have is one can use Solr Cell and Apache Tika to index pdf documents.

From some stakeoverflow I found link http://wiki.apache.org/solr/ExtractingRequestHandler but it is not tutorial or having steps to do what I want. Also, I want to call solr from .net application using solrnet.

I am using Solr 5.1 version.

I am providing sample code that I ran from solr reference document as below

bin/solr -e techproducts

It started example solr instance with techproducts core. After that I ran below command to index pdf document.

curl "http://localhost:8983/solr/techproducts/update/extract?literal.id=doc1&commit=true" -F "myfile=@example/exampledocs/solr-word.pdf"

It worked perfectly.

After that I have created new core from tomcat hosted solr server and on that I tried to run the same curl command and receiver error. I have added below request handler code in 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>

Script:

C:\tomcat-solr>curl "http://localhost:8090/solr/Core3/update/extract?literal.id=
    doc1&commit=true" -F "myfile=@example/exampledocs/solr-word.pdf"

Error:

<?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>

Did I miss anything?

1
The ExtractingRequestHandler page looks pretty detailed and comprehensive to me. What about it couldn't you follow? What didn't work when you followed it?Gagravarr
@Gagravarr - I am new to solr. I have updated my question. Kindly have a look and please provide your comments.ravi kanasagra

1 Answers

0
votes

looking at the error it seems apache-solr-cell jar and its dependencies are missing in the extraction lib in the Solr library .

<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../contrib/extraction/lib" />

add these files...