I've been working on a spellcheck module for the Search API - it's in a sandbox here:
http://drupal.org/sandbox/JoeMcGuire/1150950
It provides a Views handler field 'spellcheck' which can be added to a views header or footer. If the field is used then the handler uses pre_query() to set a search_api_spellcheck option on the SearchApiQuery object. The SearchApiQuery isn't directly accessible as everything goes via the wrapper class SearchApiViewsQuery which is missing the pass-through method setOption() which will allow a Views handler to set a query options. This patch adds that method.
Maybe easier to see in code.
contrib/search_api_views/includes/query.inc
class SearchApiViewsQuery extends views_plugin_query {
...
public function setOption($option, $value) {
if (!$this->errors) {
return $this->query->setOption($option, $value);
}
}
}
Comments
Comment #1
drunken monkeyAh, you're right,
getOption()is missing, too … Will review and fix tomorrow.Note, however, that you can already use
getOptions(), as that method returns a reference. But, of course, asetOption()method is preferable.Comment #2
drunken monkeyCommitted, thanks!
Comment #3
JoeMcGuire commentedGreat, thanks - does the dev release tag get rebuilt overnight?
There's a releated issue for the Search API Solr module here: #1153306: Spellcheck "Did you mean" - search_api_spellcheck
Comment #4
Shadlington commentedDev releases aren't rebuilt instantly, no.
Just pull from git if you're itching for the latest code ;)
Comment #5
drunken monkeyThey are rebuilt about daily, I think. It's automatic and the interval depends on how many modules are updated. I can't find any documentation on it at the moment, though.
As Shadlington says, best just use the Git code for using the latest versions. (It also simplifies updating, unless you don't have easy shell access.)
I know, I've already seen it, but it's a bit more complex to review. ;)