first import

This commit is contained in:
bachy
2013-03-12 15:26:34 +01:00
commit 6a402551d7
109 changed files with 32515 additions and 0 deletions

33
includes/spellcheck.inc Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* @file
* Contains the SearchApiSpellcheckSolr class.
*/
/**
* Spellcheck class which can provide spelling suggestions. The constructor
* populates the instance with any suggestions returned by Solr.
*/
class SearchApiSpellcheckSolr extends SearchApiSpellcheck {
/**
* Constructor.
*
* If solr has returned spelling suggestion then loop through them and add
* them to this spellcheck service.
*
* @param Apache_Solr_Response $response
* The Solr response object.
*/
function __construct(Apache_Solr_Response $response) {
if (isset($response->spellcheck->suggestions)) {
$suggestions = $response->spellcheck->suggestions;
foreach ($suggestions as $word => $data) {
foreach ($data->suggestion as $suggestion) {
$this->addSuggestion(new SearchApiSpellcheckSuggestion($word, $suggestion));
}
}
}
}
}