I set up the directories, set up the helper app (cat, in this case), and run cron, but when I go to search, there is nothing. There are no errors in the log files, and when I look into the "search_dataset" the data field for every search_files type is empty. What's going on here? Any ideas?

Comments

mgifford’s picture

Found the same issue here.

Tried with the stable & dev versions. Neither seemed to work.

File path:
/home/dm6/sites/drupal6.dev.openconcept.ca/files

Example file in path that was uploaded as an attachment:
/home/dm6/sites/drupal6.dev.openconcept.ca/files/example.pdf

The output from pdftotext:
$ pdftotext example.pdf -
Dogs cats and pickles this is just sample text what will happen here?

Would like to get this to work.

ericduran’s picture

Hey,
I got this working just find. Did you edit the Helper path in the settings?

mgifford’s picture

I could alter the helper path, just not the tabs for the title tags. I think I was using the dev version at the time though, so who knows.

Mike

dinis’s picture

Have you had any success getting this version to work under Windows?

mgifford’s picture

Yikes, Windows as a server? Nope. Can't help with you there. The base tools are definitely Linux tools though. Expect there isn't a windows equivalent.

dinis’s picture

The base tools have Windows and DOS equivalents which work fine on the original verion of this module (which is unfortunately only 5.x compatible). Not sure why you seem suprised that there are Windows server operating systems, Microsoft have been producing them for well over a decade.

And please let's not degrade this support forum into a 'Nix vs. MS debate.

mgifford’s picture

Didn't know that, cool. And yeah, no reason to start into the holy wars of OS. It is great that Drupal works in so many environments.

ericduran’s picture

is a little of topic but have you tried using powershell as a helper? You could use the get-content command which should work well at least for a txt file.

mgifford’s picture

Not sure what powershell is, but sounds like a Windows thing. This is on a debian box. We've actually gotten it to work with a txt file (and cat), but although from a command line I can parse the text from a pdf, the module wasn't picking it up. We tried on both the dev & stable versions without success.

ericduran’s picture

Hey,
Sorry for not being clear. My powershell recomendation was for the user asking about getting it working on windows.

Regarding reading the pdf document. You need to configuere the pdf helper. It doesn't work with cat.

mgifford’s picture

yeah, I did that as best as I could figure out.
http://drupal.org/node/384342#comment-1364278

Not a lot of documentation here unfortunately.

markabur’s picture

i've been trying for the past hour to get this module to index a folder but it's simply not finding any files in it. not sure what i'm supposed to put in for the path, but i've tried everything (relative to site root, relative to files folder, absolute from site root, absolute from hard drive root, etc.). every time i try something different i clear the search index and re-run cron. is there something else i should try? i've double-checked that pdftotext is installed and working properly.

ShutterFreak’s picture

Category: support » bug

Changing this to a bug report.

A patch should be trivial.

I revisited this module today after weeks of no success, and I already discovered one possible cause of files not being searched for.

The problem is that my LAMP installation returns an empty string for $_SERVER['DOCUMENT_ROOT'], hence the string representing the full path and filename of the file start with "/./" which won't ever make sense on my Drupal installation.

Edit search_files/modules/search_attachments/search_attachments.module and look for the line starting with: function _search_attachments_index_file($file). I replaced the following line:

  $contents = _search_attachments_get_file_contents($_SERVER['DOCUMENT_ROOT'] . $base_path . $file->filepath);

with the following line:

  $contents = _search_attachments_get_file_contents(file_create_path($file->filepath));

and now searching attachments suddenly works, but first clear the search cache (via admin/settings/search --> rebuild index), and then run cron.php a couple times, either in your browser or on the command line through a script like described here (won't time out).

It is probably a good thing to replace all occurrences of $_SERVER['DOCUMENT_ROOT'] . $base_path . $file->filepath with the following shorter, Drupal API compliant code snippet: file_create_path($file->filepath) throughout the module.

Best regards,

Olivier

ShutterFreak’s picture

Component: Code » Search Attachments

Setting this issue to the Search Attachments module.

conradio’s picture

Hi I wonder if you can help me PLEASE, I installed the search files module under windows what I need to do is be able to search a directory with txt files for a persons name or info in the document and return the results (files) for a person to open, my txt helper is as follows c:\\windows\\system32\\cmd.exe type %file% and my directory C:\xampp\htdocs\dot\sites\all\files the problem is that it is not returning any results.
At the point that it returns results we will have a report viewer that will open with an interpretor and display the reports in PDF.

Please help.

thl’s picture

Assigned: Unassigned » thl
Status: Active » Fixed

Hi Olivier.
Thanks for contacting me. Use of the Server variable has been removed previously but still things did not work well. Find details in node #556790: Filepath/URI handling in Search Files Attachments.
Fixed.

thl’s picture

Status: Fixed » Closed (fixed)
maverick14’s picture

+1 here. I'm using the latest 6 release.

Tried many things, several hours of changing module settings, but can't get this module to work.

I even don't know where to start debugging.