createSelect(); $query->setRows(0); // add spellcheck settings $spellcheck = $query->getSpellcheck(); $spellcheck->setQuery('delll ultrashar'); $spellcheck->setBuild(true); $spellcheck->setCollate(true); $spellcheck->setExtendedResults(true); $spellcheck->setCollateExtendedResults(true); // this executes the query and returns the result $resultset = $client->select($query); $spellcheckResult = $resultset->getSpellcheck(); echo '

Correctly spelled?

'; if ($spellcheckResult->getCorrectlySpelled()) { echo 'yes'; }else{ echo 'no'; } echo '

Suggestions

'; foreach($spellcheckResult as $suggestion) { echo 'NumFound: '.$suggestion->getNumFound().'
'; echo 'StartOffset: '.$suggestion->getStartOffset().'
'; echo 'EndOffset: '.$suggestion->getEndOffset().'
'; echo 'OriginalFrequency: '.$suggestion->getOriginalFrequency().'
'; echo 'Frequency: '.$suggestion->getFrequency().'
'; echo 'Word: '.$suggestion->getWord().'
'; echo '
'; } $collation = $spellcheckResult->getCollation(); echo '

Collation

'; echo 'Query: '.$collation->getQuery().'
'; echo 'Hits: '.$collation->getHits().'
'; echo 'Corrections:
'; foreach($collation->getCorrections() as $input => $correction) { echo $input . ' => ' . $correction .'
'; } htmlFooter();