Closed (fixed)
Project:
Search API Solr
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Feb 2013 at 13:03 UTC
Updated:
13 Aug 2015 at 10:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ramlev commentedAdded the patch
Comment #2
ramlev commentedNew patch, sends more data from the alter hook.
Comment #3
ramlev commentedNew patch, sends more data from the alter hook.
Comment #4
arnested commentedJust a reroll of the patch for 7.x-1.x.
Comment #5
drunken monkeyThanks for the suggestion and for re-rolling, and sorry I didn't see this earlier.
Makes a lot of sense, of course, especially in combination with the recent and upcoming feature additions to the Search API Autocomplete module. However, what's missing from the patch is documentation for the new hook in
search_api_solr.api.php.Also, I think we shouldn't call the hook twice, once for each search request (if there are two), but once with the final suggestions. We can just save both queries and responses in array keys. I.e.,
$alter_data['queries'][] = $query;.Lastly, I think it would be more in line with Drupal's usual standards to have the suggestions you want to alter as the first parameter, and the additional data/context in the second.
If someone fixes these, I'll gladly commit the patch.
(Also, please set the status to "Needs review" if there is a patch.)
Comment #6
n20 commentedWould i be able to alter search_api_autocomplete with this patch? Im a little bit confused since this patch is for search_api_solr
Comment #7
drunken monkeyThe thing is that the search backend you are using is responsible for creating the suggestions you're seeing (at least by default). Therefore, to be useful, an alter hook has to be placed in the search backend's code (Solr, in this case) to be useful.
So, with this patch, if you are using a Solr backend for your Search API server, you'll be able to alter the returned suggestions, yes.
Comment #8
arnested commentedHi @drunken monkey,
I am looking in to your suggestions right now. Stay tuned.
Comment #9
arnested commentedAnother go at this. Includes @drunken monkeys suggestions from #5.
Comment #10
drunken monkeyThanks a lot for revising the patch, looks much better!
However, I was of course mistaken in writing that multiple queries should be passed in the alter data – the query is always the same. Sorry about that. Both responses should be enough, I'd say, as they always occur in the same order anyways. If someone really has to know the exact Solr parameters, they can just alter the Solr query as well to remember it or include
echoParams=true.Anyways, here is a revised patch which is RTBC from my point of view. Would be great if you could still review it, though, and/or try it out.
Comment #11
arnested commentedLooks fine!
Comment #12
drunken monkeyGood to hear, thanks for reviewing!
Committed.
Thanks again, everyone!