Closed (fixed)
Project:
Search Files
Version:
6.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 May 2010 at 21:59 UTC
Updated:
30 Aug 2011 at 09:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
dean.p commented*Edit: Sorry, misspelling in the title *fixed*
Comment #2
jpcwebb commentedI'd definately support this feature - my site has hundreds of image files uploaded, any only a handful of pdfs and other files, so the search indexing is wasting a lot of time churning through all the images before it gets to the pdfs.
Comment #3
duncanc commentedFor search_files_attachments to limit indexing to only those files that have helpers defined, then this sql needs to be added to queries in two places
1) add to two queries in the 'status' processing within function search_files_attachments_search so that the correct counts are returned
2) add to the query in the search index processing within function search_files_attachments_update_index so that only files whose file type has a helper are selected.
Comment #4
jpcwebb commentedThanks for the tip - could this be made into a patch?
Comment #5
jpcwebb commentedHmm, even applying these changes does not seem to prevent the search_dataset table from filling up with hundreds of rows with no data for type 'search_files_att' - that's what I'd like to avoid
Comment #6
duncanc commentedI forgot to mention that I had to uninstall the module in order to remove the existing rows in search_dataset, and then reinstall.
Or you can run the sql manually, see the file search_files_attachments.install
Then re-index again.
Having looked at the code, I'm not sure that my suggestion is quite enough. The module uses the files table to drive the processing, but I think it should use the upload table instead. That would limit it to files attached to nodes instead of all possible files, as it currently does.
But that's a bigger change!
Comment #7
jpcwebb commentedI agree that would cut down the base index selection by a significant margin
Comment #8
duncanc commentedHere is a modified search_files_attachments.module that includes the SQL changes I explained previously. The change limits indexing to only those attachments which have a helper defined.
It is based on version 6.x-2.0-beta4, the current recommended release.
To remove the unnecessary rows from search_dataset table you will need to first disable the module "Search files in attachments", and then uninstall it on the module administration page.
Then replace the distributed search_files_attachments.module with the modified file, enable the module, and trigger an index update on the administration page.
Feedback welcome!
Comment #9
duncanc commentedForgot to attach the file - rename to remove the .txt extension.
Comment #10
candelas commentedthanks @duncanc, i have applied your patch and works perfect.
i think it should be on the dev version, since it has not sense to index files that you cant translate to the search index... and it is causing that crons hangs with big photo files...
@duncanc made this one year ago and i am working with the dev version at the moment, so i report here the changes for this version. i have looked among 6.x.2.x-dev, 6.x.2.0-beta4 and duncanc txt line by line.
i dont know how to make patches and i have to finish a work. please someone that knows howto, make a patch and submit, since it is important and makes this supermodule not to have problems with crons... and make search index much clean:
line 62
from
to
line 196 (moved because i pasted the code from before and i have also applied patch in http://drupal.org/node/965474#comment-3782776 for problems with encoding characters sets (works))
from
to
i have tested and my cron goes much better and not empty records on the table.
@duncanc thanks a lot!!!
Comment #11
jrglasgow commentedI have committed this code
In the future it would be better to have a patch instead ofa replacement file or code in the comment.
to learn to make a patch you can click on the "Version Control" tab for the module, select the proper branch for the module and follow the instruction to clone the repo. then make changes to the file, and then follow instructions to create a patch
Comment #12
candelas commentedthanks, i will do it