1

I'm running Drupal 7.12. I have a requirement to index files attached to nodes. (DOC, PDF, XLS, etc).

After quite a bit of trail and error, reading and searching I have been unable to get any of the attachment file indexing modules to work.

Search API Attachments seems the most promising but after configuring it doesn't seem to index any of the documents. It does call Tika to process attachments to new nodes, but doesn't seem to re-index any existing nodes. Searching on any file contents yields no results.

Any thoughts on what I should investigate to track this down would be greatly appreciated. Anyone running this module successfully? If so how did you configure it.

More info:

I followed these instructions: http://permalink.gmane.org/gmane.comp.php.drupal.support/22390

To see if I can track this down:

  • I configured a fresh installation of Drupal 7.12.

  • I installed Search API, Search API DB and Search API Attachments

    • projects/search_api_db-7.x-1.x-dev.tar.gz
    • projects/search_api_attachments-7.x-1.2.tar.gz
    • projects/search_api-7.x-1.0.tar.gz
  • I installed Tika and verified that it is working per instructions.

  • I created a field called Attachment1 of type File for the "Article" content type: structure -> content types -> article. label: Attachment1 name: field_attachment1, field: File.

  • I created a search server in Configuration -> Search and metadata -> search api using the database service class.

  • I then edited the Default Node Index to use the search server I defined and enabled it.

  • I then went to the Default Node Index fields and using "Add Related Fields" added Attachment1 » The file.

  • I checked the box next to Attachment1 >> The file and Attachment content: field_attachment1

  • I created a single Article and attached a word document to it.

  • I ran the cron service from the admin menu.

  • In the database I ran select * from search_index and I notice that only the terms from the node content are present, nothing from the document that I uploaded.

  • I verified that Tika was being called by adding the syslog call prior to shell_exec which yields:

Mar 17 13:32:06 xeon httpd: Calling Tika: java -Dfile.encoding=UTF8 -cp '/usr/local/tika' -jar '/usr/local/tika/tika-app-1.0.jar' -t 'http:///drupal/sites/default/files/Resume_0.doc'

However, if I select to re-index the site by going to Configuration -> Search and metadata -> search settings -> clear index and re-run cron I notice that Tika is NOT being called.

Also I notice that selecting clear index does not affect the search_index table. (Should it?)

I have separately verified that Tika is properly extracting the text from the document by logging it to a file prior to the call.

My feeling is that I'm missing something obvious.

2

2 Answers 2

2

Ok, this looks like part of this is a case of PEBKAC. Or maybe could be considered an issue of documentation.

It looks like the default search box form does not interface with search API and that in order for the search API indeces to be used you must use the Search API Pages module.

However, re-indexing definitely does NOT re-index attachments on existing nodes. I'm not sure whether it's supposed to or not but that is what threw me to believe it was not working.

1

Did you select the "File Attachments" option in the Workflow tab of your index?

enter image description here

1
  • yes, I did. It turns out the mistake I was making was not using the Search API Pages module for the search box. I had mistakenly thought the search API would "take over" the existing search box. (Unless that's how it's supposed to work.) Commented Mar 26, 2012 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.