When drupal sends a $op='reset' message to hook_search, this mdoule fails to reset Solr's indexes. Here is a patch to fix that.

Patch applied from module's directory.

CommentFileSizeAuthor
apache-solr-reset.patch881 bytesmattconnolly

Comments

drunken monkey’s picture

I think it doesn't do that because it shouldn't. If 'reset' is sent, according to the specification at http://api.drupal.org/api/function/hook_search/6 the index should be rebuilt, but I don't think it should be wiped, just updated. This is also indicated by the text you get when accessing this function at admin/settings/search/wipe:

The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won't be indexed until all existing content has been re-indexed. This action cannot be undone.

But many thanks for clearing up #271319: This patch provides a Delete Index button for Solr!

senpai’s picture

Status: Needs review » Needs work

#1 is correct. We shouldn't delete all of SOLR's cache with the Drupal re-index site button. I vote -1 on this patch as it's currently written, but would like to see some more integration between Drupal buttons and SOLR's capabilities. I wonder if you might try rebuilding the SOLR index if the admin/settings/search/wipe form is submitted. Does SOLR even have an API function for reindexing vs. deletion?

drunken monkey’s picture

In this case, the issue should be marked "won't fix" or "by design", rather than "needs work", I think. Other functionality would be a different issue, after all.

I wonder if you might try rebuilding the SOLR index if the admin/settings/search/wipe form is submitted. Does SOLR even have an API function for reindexing vs. deletion?

If I understand you correctly, that's exactly what's happening at the moment. The variables for the last added node are reset, so at the next cron run, the nodes 1-100 will be reindexed. Solr automatically does this, when sent a document with the same unique key (nid in our case) as an existing one. The nodes that already are in the index will still be found all the while. A delete is currently only carried out, if the corresponding node is deleted, afaik.

robertdouglass’s picture

Status: Needs work » Closed (works as designed)

Agree with drunken monkey. This is the way Drupal's core index works and I'd like to keep the functionality. Further discussion should happen at #271319.