This patch adds the commands "search status" and "search reindex". Here is a possible use case:
drush -y search reindex
while [ $(drush search status --pipe | sed "s:/.*::") != 0 ] ; do
drush cron
done
I've only actually tested this on D6 so far.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drush-search.patch | 4.51 KB | john morahan |
| drush-search.patch | 2.75 KB | john morahan |
Comments
Comment #1
moshe weitzman commentedThats pretty neat. I think that drush reindex should optionally perform the reindexing in addition to the wipe. Also, don't we need an argument to specify which index needs to be wiped - node, user, etc. I haven't looked into search api in a while ... lets document the --pipe option for status.
Comment #2
john morahan commentedAdded an --immediate option for immediate reindexing, and a separate "search index" command to do this without wiping first. Also mentioned the --pipe option in help.
Search doesn't seem to provide an API for rebuilding a specific index, unless I've missed something. I guess we could module_invoke($module, 'search', 'reset') directly, if you really want this?
Comment #3
moshe weitzman commentedOn D7 at least, I see search_reindex($sid = NULL, $type = NULL, $reindex = FALSE)
Oddly, I don't see apachesolr implementing that hook. Thats what I'd want to use. Oh well.
Comment #4
john morahan commentedAFAICT that doesn't wipe a whole index (which I assume is what you want) - it only wipes one specific item from an index, e.g. a single node. It also doesn't invoke any hooks while doing so, which is why apachesolr doesn't implement it. It only invokes hook_search('reset')/hook_search_reset() if you wipe the whole search index i.e. search_wipe()/search_reindex() with no parameters.
Comment #5
moshe weitzman commentedCommitted with minor changes. Added a drush_log() on remaining item count and added minor conditional when search_cron_limit is 0 (used by apachesolr).
Comment #7
kcvata commentedI am using the "search statuses" module. However, after searching for the #hashtagofinterest I do not want the extra step of clicking on the #hashtagofinterest to retrieve the all the statuses with that particular #hashtagofinterest.
I believe it is little code work. Any help with that will be greatly appreciated.
Regards,
Korkut Vata