Is there any way include pdf files in common drupal search. I tried http://drupal.org/project/search_files module. But it gives the results under a separate tab. Is there any to include them in common drupal search. I merger the result using hook_preprocess_search_results.

   $file_results = module_invoke('search_files', 'search', 'search', arg(2));
   $count = count($variables['search_results']);
   $variables['search_results'] = '';
   $f = null;
   $filecount = $count + 1;
   foreach ($file_results as $result) {
      $f[$filecount] = $result;
   $variables['results'] = array_merge($variables['results'], $f);

But this also is not working. Anybody can suggest a solution? And one more doubt. Is there any way to change search result count.


In my opinion the best thing to use for file search is the http://drupal.org/project/apachesolr module along with the http://drupal.org/project/apachesolr_attachments module. I probably wouldn't do file searching without solr.

You would then turn off the basic drupal search page and just use the solr one.

It will require a bit of extra setup though and you might not be able to do it if you are on shared hosting.

There is an issue for combining the search files and search pages here - http://drupal.org/node/368195

Unfortunately there isn't a proper patch to use but there is some code in there. You will just have to do a bit of work yourself to get it going.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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