Commit 706ec745 authored by Markus Kalkbrenner's avatar Markus Kalkbrenner

fixed examples for suggester and spellcheck #536

parent 08fce181
......@@ -8,8 +8,7 @@ $client = new Solarium\Client($config);
// get a spellcheck query instance
$query = $client->createSpellcheck();
$query->setQuery('ap ip v'); //multiple terms
$query->setDictionary('suggest');
$query->setQuery('cort');
$query->setOnlyMorePopular(true);
$query->setCount(10);
$query->setCollate(true);
......@@ -27,7 +26,7 @@ foreach ($resultset as $term => $termResult) {
echo 'EndOffset: '.$termResult->getEndOffset().'<br/>';
echo 'Suggestions:<br/>';
foreach ($termResult as $result) {
echo '- '.$result.'<br/>';
echo '- '.$result['word'].'<br/>';
}
echo '<hr/>';
......
......@@ -8,7 +8,7 @@ $client = new Solarium\Client($config);
// get a suggester query instance
$query = $client->createSuggester();
$query->setQuery('ap ip v'); //multiple terms
$query->setQuery('c');
$query->setDictionary('mySuggester');
$query->setBuild(true);
$query->setCount(10);
......@@ -19,20 +19,17 @@ $resultset = $client->suggester($query);
echo '<b>Query:</b> '.$query->getQuery().'<hr/>';
// display results for each term
foreach ($resultset as $term => $termResult) {
echo '<h3>' . $term . '</h3>';
echo 'NumFound: '.$termResult->getNumFound().'<br/>';
echo 'StartOffset: '.$termResult->getStartOffset().'<br/>';
echo 'EndOffset: '.$termResult->getEndOffset().'<br/>';
echo 'Suggestions:<br/>';
foreach ($termResult as $result) {
echo '- '.$result.'<br/>';
foreach ($resultset as $dictionary => $terms) {
echo '<h3>' . $dictionary . '</h3>';
foreach ($terms as $term => $termResult) {
echo '<h4>' . $term . '</h4>';
echo 'NumFound: '.$termResult->getNumFound().'<br/>';
foreach ($termResult as $result) {
echo '- '.$result['term'].'<br/>';
}
}
echo '<hr/>';
}
// display collation
echo 'Collation: '.$resultset->getCollation();
htmlFooter();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment