Closed (won't fix)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2009 at 11:20 UTC
Updated:
16 Oct 2012 at 08:20 UTC
I deleted a couple of terms in a taxonomy but i was still able to see those terms in the solar index. i feel that deleting a taxonomy term should trigger an index update ....
Comments
Comment #1
pwolanin commentedin apachesolr.module, we have a TODO for this (i.e. it's a known issue). Patches welcome.
Comment #2
pwolanin commentedComment #3
meba commentedTerm deletion is not easy due to oldness of taxonomy API. When hook_taxonomy delete is called, term_node table is already empty - we have no way of knowing what nodes had the deleted term assigned.
Only way I can think of right now is a separate callback for taxonomy delete form, taking care of the update BEFORE the deletion happens.
Comment #4
pwolanin commentedPossibly - though that would miss other programmatic calls.
Alternately, we have to duplicate the whole term node table.
That would be ugly...
Comment #5
jpmckinney commentedComment #6
pwolanin commentedSo looks like the only way to start tackling this is via watching form submission - sad, but it will get us 90% there I think.
Comment #7
shiraz dindarI'm trying to understand something here. After deleting some terms via the Taxonomy Manager module, nodes with that tag were not marked for reindex due to this issue. The result is the deleted term's numeric ID shows up in place of the term name in the Apache solr results (because it can't find the term name for a term tagged to a node, only the TID which is stored in the node).
To clear the numeric, dead-end TIDs from the Apache solr results, I visited the Apache solr index page and submitted to "Index queued content". This works. The question is, why does it work? That option simply calls the apachesolr_batch_index_remaining function, the function which looks at nodes marked for needing re-indexing. But these nodes were never marked for re-indexing. So why does it work? (And would there be any problem in simply calling apachesolr_batch_index_remaining in the apachesolr_taxonomy for case 'delete'?)
Any insights appreciated!
Thanks,
Shiraz
Comment #8
jpmckinney commentedComment #9
janusman commented@Shiraz: I tried the same, but couldn't reproduce your behavior. That is, I deleted a term that appeared in 2,800+ nodes, went to admin/settings/apachesolr/index, and I only had "48 nodes to index" (due to other changes). Triggering "Index queued content" only indexed those 48, not my 2,800 changed nodes.
In your case, what is the message on that URL? (e.g. "The search index is generated by running cron. X% of the site content has been sent to the server. There are Y items left to send.")
Comment #10
janusman commented@pwolanin: If I get this correctly, you're suggesting should do a form_alter on the taxonomy_term_confirm_delete form, adding our own #submit callback when "Delete this term" confirmation is given?
Comment #11
pwolanin commented@janusman - that was the suggestion, but I have no idea what the "Taxonomy Manager module" is. Obviously such an approach would fail for such a contrib module.
Comment #12
janusman commentedUh, yeah... other modules deleting terms would be out of our reach with the form_alter approach.
An alternate option is to still depend on hook_taxonomy($op = "delete"), but query against the Solr index to find what is in the index with the deleted term's tid, and then mark those nodes. Would this work?
Comment #13
pwolanin commentedWell, not sure - how would you handle e.g. 20k or 100k nodes? An IN() query is likely to fail assuming you can even pull back all the data from Solr.
Though given that we index parent terms, that might be most reliable in terms of finding all the nodes that need to be touched.
The only real alternative I can think of is to make a duplicate {term_node} table which would include copying parts of http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/func...
Comment #14
nick_vhClosing as this is very outdated and no-one seems to respond or care anymore