This was partially covered by #449214: use tika, but have you considered using Solr's ExtractingRequestHandler? This handler uses Tika to do extraction and assist with indexing.

Comments

pwolanin’s picture

Yes, the goal is to have that as an option to do the extraction remotely - so your suggestion is very much on the roadmap!

anarchivist’s picture

Great! I've found that the ExtractingRequestHandler is pretty trivial to set up.

anarchivist’s picture

One question/concern I had was about indexing large files - is storing them in body appropriate? Would an indexed but non-stored field be more appropriate?

pwolanin’s picture

I think it needs to be stored so that the highlighter can work on it.

pwolanin’s picture

in terms of remote extract, oe thing to add will probably be local caching (in DB or files) of the extracted text, so that one doesn't need to send the file over again for extraction if just the meta-data like taxonomy is updated.

I don't think we want to index directly into Solr via the request handler, since then we'd have to rewrite the PHP library in terms of sending over other POST variables.

anarchivist’s picture

I don't think local caching is necessary - one way to check would just be to check the file size or update time...

pwolanin’s picture

I strongly disagree - imagine you send a 10 MB PDF (e.g. with lots of images) and get ~5 kB of text back. It would be very silly not to locally cache the extracted text vs. waiting for the upload and processing time any time the related node or meta data was updated.

pwolanin’s picture

Status: Active » Needs work
StatusFileSize
new6.82 KB

Here's a start on this - just setting the groundwork.

pwolanin’s picture

playing with this today - looks like we relly need to post multi-part for data like described:

http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1

Here's the solrconfi.xml stanza I'm using (need to update the patch).

  <!-- An extract-only path for accessing the tika utility -->
   <requestHandler name="/extract/tika" class="org.apache.solr.handler.extraction.ExtractingRequestHandler" startup="lazy">
      
    <lst name="defaults">        
    </lst>
    <!-- This path only extracts - never updates -->
    <lst name="invariants">
      <bool name="extractOnly">true</bool>
    </lst>
  </requestHandler>

I had to copy jar files around to get it to work with multi-core

see: http://wiki.apache.org/solr/ExtractingRequestHandler

pwolanin’s picture

StatusFileSize
new8.22 KB

Argh - this is not really working, but a start.

pwolanin’s picture

StatusFileSize
new8.27 KB
pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new13.06 KB

requires this patch to work: http://drupal.org/node/612024#comment-2190226

with revised solrconfig patch and some other refactoring.

pwolanin’s picture

finally figuring out how to format the POST body correctly required resorting to running tcpdump and posting a document to extract with curl following the solr wiki example. For future ref, I did a tcpdump on the localhost will running solr on my laptop:

$ sudo tcpdump -i lo0 -s0 -w dump.tcp
tcpdump: listening on lo0, link-type NULL (BSD loopback), capture size 65535 bytes
^C
23 packets captured
23 packets received by filter
0 packets dropped by kernel

$ tcpdump -r dump.tcp -A
...
pwolanin’s picture

StatusFileSize
new19.07 KB
pwolanin’s picture

committed to HEAD, leaving issue open for any minor follow-up

pwolanin’s picture

Status: Needs review » Fixed
StatusFileSize
new846 bytes

minor cleanup patch committed. let's call this done for now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.