Wikia/app — pull request #261 by relwell (2012-12-12 23:10:54+00:00)
Title: WikiaSearch: Spellcheck

This introduces spellcheck capabilities to WikiaSearch, hidden behind $wgWikiaSearchSpellcheckActivated, which is currently null.

We probably won't want to turn this on until we upgrade to 4.0, because spellchecking against an index comprising of multiple corpora is presently impossible. Every spellcheck we perform is done against a separate index that doesn't have any additional data -- meaning that we can't tell Solr not to suggest a term with more instances for the provided subquery that *isn't* in the current wiki.

A basic overview of what has changed:

* The logic in WikiaSearch::doSearch has been broken up into three subroutines: WikiaSearch::preSearch, WikiaSearch::search, and WikiaSearch::postSearch
* WikiaSearch::preSearch primarily handles pagination and grouping
* WikiaSearch::search is a recursive function that guarantees the return of an instance of Solarium_Result_Select (empty or not)
* WikiaSearch::postSearch handles building the WikiaSearchResultSet instance and tracking
* WikiaSearch::handleSpellcheck has been introduced, but is currently inactive
* The Solarium library has been updated to handle Solr 4.0's spellcheck.collateParams.xx parameters (a pull request has been issued to the main project at https://github.com/basdenooijer/solarium/pull/138 )

These changes have been fully tested. The changes to Solarium have also been united tested, but as a "vendor library" those unit tests have not been ported over to the Search extension.