Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Framework
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2012 at 07:16 UTC
Updated:
10 Apr 2013 at 09:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
drunken monkeyWhat about
hook_search_api_index_items_alter()? Wouldn't that be enough for your use case?I mean, if it's a custom module, you'll know what items (if any) will be rejected by data alterations, so you could just register a shutdown function (to really make sure that the items have already been indexed when the cache is cleared) and clear the cache there.
But I'd also not really be against adding this new hook. Shouldn't be a performance problem or anything, and more hooks are a good thing in most cases. ;)
It's not very helpful to use a method in the example code that doesn't exist, though. ;) The hook documentation also fits better right after the corresponding alter hook, I think. You had it even outside of the
@addtogroup hooksblock.Lastly, I think it should be called
hook_search_api_items_indexed(). The singular is a bit confusing (it's the same for the function, I know, that's my fault) and the "track" doesn't really fit there, either (and makes things more confusing when it's almost the function name, but not exactly).So, if we really add this hook, then with the patch attached (or a further improved variant, of course). Please review!
Comment #2
das-peter commentedHmm, that's an interesting idea and I think that could be an viable approach. However, somehow I personally don't like to register shutdown functions and try to avoid it whenever possible.
So if you don't mind to add the hook I'd prefer to add it :)
I guess you mean
$index->getEntityType()- that's just because I'm coming from the future - the code will become valid as soon as #1760706: Add a flexible way for determining whether an index contains entities is in :PPatch looks good to me. Only nit-picky thing I could find is
An array of the indexed item ids.insteadAn array of the indexed items.But I'm bold enough to set this to RTBC.
Comment #3
drunken monkeySlightly rephrased hook documentation and committed.
Thanks again!