I've searched a lot to find a module which satisfy my needs, but haven't found anything so far. Asking here is my last shot prior to go writing a module of my own, because a nice search experience is crucial and it's hard to believe nobody else ever needed the same thing as I do.
This is the situation:
-There are many PDF files in a folder accessible in the internet (in this case, inside drupal folder/sites//files/folder);
NOTE: these files were manually inserted in the folder (and not through any Drupal interface or module).
-These PDF files must have its contents indexed to be found from the website's search.
-The user must be able to make *ONE* search, where this search must return results from both contents AND pdf files, just like Google :), why make it different?
At first I tried Drupal's default search, with file search module and its helpers (i.e., pdf2text). I got pretty close here, BUT, the user must click in a "Directories" tab, and the search results will be always separate (contents / files). No good, no deal.
Then I tried the Apache Solr module (http://drupal.org/project/apachesolr), along with the apachesolr attachments module (https://drupal.org/project/apachesolr_attachments). Everything seemed sweet until I found that it will only index the files that are attached to a node. hann.. Almost!
I thought about a solution such as this one (attaching files to nodes programatically): http://workingdirectory.net/posts/2009/attach-file-to-node-drupal-6/ , with the Solr engine, but I might eventually forget about this script and run into problems in a future Drupal update/upgrade, so I'll leave this as last option.
Any clues??
Regards,
Thiago
Comments
Not sure if this would work
Not sure if this would work but make a views exposed search and try an attachments view type
Thanks for your suggestion.
Thanks for your suggestion. However, remember that the files are copied to the folder from the command line, and not using any Drupal interface (because there are so many that it is not practical), so what happens is that the files are not attached to any node, thus there aren't any "attachments" from Drupal's point of view. For that I would also have to use the idea of "attaching files to nodes programatically", but I haven't found any official way to do this either so far..
How i would do this?
You could create a cron job and make node's programmatically with the new file as an attachement.
You should use the files table for this.
To appear in your search results I think you best publish your nodes on insertion.
That's how I would do this.
Add me on linkedin:
http://be.linkedin.com/in/woutersfrederik
Detail steps to do this
Hi Drupal_Sensei,
I am a newbie. I am having the same issues. I copied files to sites/default/files and trying to search and it is not displaying. How to add these files to node programatically. Thanks.