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);
    }
  }
}
CommentFileSizeAuthor
search-api-views-query-set-option.patch474 bytesJoeMcGuire

Comments

drunken monkey’s picture

Ah, 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, a setOption() method is preferable.

drunken monkey’s picture

Status: Active » Fixed

Committed, thanks!

JoeMcGuire’s picture

Great, 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

Shadlington’s picture

Dev releases aren't rebuilt instantly, no.

Just pull from git if you're itching for the latest code ;)

drunken monkey’s picture

Great, thanks - does the dev release tag get rebuilt overnight?

They 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.)

There's a releated issue for the Search API Solr module here: #1153306: Spellcheck "Did you mean" - search_api_spellcheck

I know, I've already seen it, but it's a bit more complex to review. ;)

Automatically closed -- issue fixed for 2 weeks with no activity.