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
f59693a8
Commit
f59693a8
authored
Jan 29, 2014
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:basdenooijer/solarium into develop
parents
67b49fdf
abef42ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
11 deletions
+34
-11
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
.../QueryType/Select/ResponseParser/Component/Spellcheck.php
+7
-1
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/SpellcheckTest.php
...ryType/Select/ResponseParser/Component/SpellcheckTest.php
+27
-10
No files found.
library/Solarium/QueryType/Select/ResponseParser/Component/Spellcheck.php
View file @
f59693a8
...
@@ -86,7 +86,13 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf
...
@@ -86,7 +86,13 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf
$collations
=
$this
->
parseCollation
(
$query
,
$value
);
$collations
=
$this
->
parseCollation
(
$query
,
$value
);
break
;
break
;
default
:
default
:
$suggestions
[]
=
$this
->
parseSuggestion
(
$key
,
$value
);
if
(
array_key_exists
(
0
,
$value
))
{
foreach
(
$value
as
$currentValue
)
{
$suggestions
[]
=
$this
->
parseSuggestion
(
$key
,
$currentValue
);
}
}
else
{
$suggestions
[]
=
$this
->
parseSuggestion
(
$key
,
$value
);
}
}
}
}
}
...
...
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/SpellcheckTest.php
View file @
f59693a8
...
@@ -50,8 +50,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -50,8 +50,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
$data
=
array
(
$data
=
array
(
'spellcheck'
=>
array
(
'spellcheck'
=>
array
(
'suggestions'
=>
array
(
'suggestions'
=>
array
(
0
=>
'delll'
,
'delll'
,
1
=>
array
(
array
(
'numFound'
=>
1
,
'numFound'
=>
1
,
'startOffset'
=>
0
,
'startOffset'
=>
0
,
'endOffset'
=>
5
,
'endOffset'
=>
5
,
...
@@ -63,8 +63,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -63,8 +63,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
),
),
),
),
),
),
2
=>
'ultrashar'
,
'ultrashar'
,
3
=>
array
(
array
(
'numFound'
=>
1
,
'numFound'
=>
1
,
'startOffset'
=>
6
,
'startOffset'
=>
6
,
'endOffset'
=>
15
,
'endOffset'
=>
15
,
...
@@ -76,10 +76,23 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -76,10 +76,23 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
),
),
),
),
),
),
4
=>
'correctlySpelled'
,
'ultrashar'
,
5
=>
false
,
array
(
6
=>
'collation'
,
'numFound'
=>
1
,
7
=>
array
(
'startOffset'
=>
16
,
'endOffset'
=>
25
,
'origFreq'
=>
0
,
'suggestion'
=>
array
(
0
=>
array
(
'word'
=>
'ultrasharp'
,
'freq'
=>
1
,
),
),
),
'correctlySpelled'
,
false
,
'collation'
,
array
(
0
=>
'collationQuery'
,
0
=>
'collationQuery'
,
1
=>
'dell ultrasharp'
,
1
=>
'dell ultrasharp'
,
2
=>
'hits'
,
2
=>
'hits'
,
...
@@ -92,8 +105,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -92,8 +105,8 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
3
=>
'ultrasharp'
,
3
=>
'ultrasharp'
,
),
),
),
),
8
=>
'collation'
,
'collation'
,
9
=>
array
(
array
(
0
=>
'collationQuery'
,
0
=>
'collationQuery'
,
1
=>
'dell ultrasharp new'
,
1
=>
'dell ultrasharp new'
,
2
=>
'hits'
,
2
=>
'hits'
,
...
@@ -115,6 +128,10 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -115,6 +128,10 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
$suggestions
=
$result
->
getSuggestions
();
$suggestions
=
$result
->
getSuggestions
();
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
$this
->
assertEquals
(
false
,
$result
->
getCorrectlySpelled
());
$this
->
assertEquals
(
'dell'
,
$suggestions
[
0
]
->
getWord
());
$this
->
assertEquals
(
'dell'
,
$suggestions
[
0
]
->
getWord
());
$this
->
assertEquals
(
'ultrasharp'
,
$suggestions
[
1
]
->
getWord
());
$this
->
assertEquals
(
6
,
$suggestions
[
1
]
->
getStartOffset
());
$this
->
assertEquals
(
'ultrasharp'
,
$suggestions
[
2
]
->
getWord
());
$this
->
assertEquals
(
16
,
$suggestions
[
2
]
->
getStartOffset
());
$this
->
assertEquals
(
'dell ultrasharp'
,
$result
->
getCollation
()
->
getQuery
());
$this
->
assertEquals
(
'dell ultrasharp'
,
$result
->
getCollation
()
->
getQuery
());
$collations
=
$result
->
getCollations
();
$collations
=
$result
->
getCollations
();
$this
->
assertEquals
(
'dell ultrasharp'
,
$collations
[
0
]
->
getQuery
());
$this
->
assertEquals
(
'dell ultrasharp'
,
$collations
[
0
]
->
getQuery
());
...
...
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