Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2011 at 09:46 UTC
Updated:
18 May 2016 at 11:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jsacksick commentedImplements hook_modules_enabled().andImplements hook_modules_disabled().And use
drupal_static_reset('search_api_get_item_type_info');to fix this issue.Comment #2
drunken monkeyYou have a search index on search facets? Seems like a rather weird use case to me …
Anyways, this should of course be fixed, and your solution seems like the best idea. Only flaw is that
hook_modules_enabled()andhook_modules_disabled()don't go into the .install file, as far as I know. Also, maybe someone else will want to comment on this.Comment #3
drunken monkeyComment #4
jsacksick commentedHere is the new patch, with the code in the search_api.module file this time. Is that correct ?
Comment #5
damien tournoud commentedNo, that's not what's happening. The problem is that if
search_apiandsearch_api_facetsare enabled in the same request, the newsearch_api_facetentity registered bysearch_api_facetsdoesn't made it tosearch_api_get_item_type_info()because of the static cache.As a consequence,
search_api_entity_insert()fails when a new facet entity is created.Note: currently,
search_apiis processing every entity regardless if it participates in an index or not. Not sure this is actually desirable.Comment #6
jsacksick commentedCoding standards fix.
Comment #7
drunken monkey@ #5: Ah, you're right, that is a bit unnecessary (even if it has little impact without the bug). And sadly, the bug could still occur after fixing this, so we'll have to still include the
hook_modules_[en/dis]abled()implementation …Attached patch should fix both issues.
@ jsacksick: Yes, the re-roll was fine, thanks!
Comment #8
damien tournoud commentedLooking at this, is there a reason why
search_api_track_item_insert()andsearch_api_track_item_delete()call the datasource unconditionally, whilesearch_api_track_item_change()only call it whenindex_directlyis FALSE?Comment #9
drunken monkeyYes, of course. Even if items are indexed directly, their status has to be tracked (since "Index immediately" could be de-activated later, or indexing could fail some time). If we wouldn't notify the datasource of inserts and deletes, the respective items would never be in the tracking table (or stay there forever), and also not marked as dirty later, when "Index immediately" would be deactivated. When the item changes, it is already present in the tracking table, and we don't have to do anything if we index it immediately.
Comment #10
drunken monkeyWe also shouldn't react to operations on entity types which don't have property information (as we don't provide search integration for those). This should be caught by them not having any indexes anyways, but still better to additionally save the runtime.
@ rgraaf: Both the patch in #7 and this one should work for you (I hope).
Comment #11
drunken monkeyCommitted. Thanks again for your contribution, jsacksick!
Comment #13
ticaasd commentedi have the #10 patch applied in a clean commerce kickstart project and i get the same error
Comment #14
jsacksick commentedThis patch has been committed almost 2 years ago, why do you need to apply it again ? On a clean Kickstart, it never happened to me.
Comment #15
N1ghteyes commentedjust confirming, im also having this issue with a clean kickstart install,
search_api version 7.x-1.7, so the patch doesn't apply here..
SearchApiException: Unknown or invalid item type node. in search_api_get_datasource_controller() (line 1506)Comment #16
zuernbernhard commentedSearchApiException: Unknown or invalid item type profile2
Comment #17
berliner commentedHaving the same issue in Search API 1.8 with the Sarnia module.