Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
706ec745
Commit
706ec745
authored
Dec 31, 2017
by
Markus Kalkbrenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed examples for suggester and spellcheck #536
parent
08fce181
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
examples/2.6-spellcheck-query.php
examples/2.6-spellcheck-query.php
+2
-3
examples/2.6-suggester-query.php
examples/2.6-suggester-query.php
+9
-12
No files found.
examples/2.6-spellcheck-query.php
View file @
706ec745
...
...
@@ -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/>'
;
...
...
examples/2.6-suggester-query.php
View file @
706ec745
...
...
@@ -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
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment