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
1707d4b5
Commit
1707d4b5
authored
May 15, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #88 from teuneboon/master
Fixed collations to be able to use multiple collations
parents
944bf5c7
585090bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
11 deletions
+32
-11
library/Solarium/Client/ResponseParser/Select/Component/Spellcheck.php
...ium/Client/ResponseParser/Select/Component/Spellcheck.php
+3
-3
library/Solarium/Result/Select/Spellcheck.php
library/Solarium/Result/Select/Spellcheck.php
+29
-8
No files found.
library/Solarium/Client/ResponseParser/Select/Component/Spellcheck.php
View file @
1707d4b5
...
@@ -66,7 +66,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
...
@@ -66,7 +66,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
$suggestions
=
array
();
$suggestions
=
array
();
$correctlySpelled
=
null
;
$correctlySpelled
=
null
;
$collation
=
null
;
$collation
s
=
array
()
;
$index
=
0
;
$index
=
0
;
while
(
isset
(
$spellcheckResults
[
$index
])
&&
isset
(
$spellcheckResults
[
$index
+
1
]))
{
while
(
isset
(
$spellcheckResults
[
$index
])
&&
isset
(
$spellcheckResults
[
$index
+
1
]))
{
...
@@ -78,7 +78,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
...
@@ -78,7 +78,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
$correctlySpelled
=
$value
;
$correctlySpelled
=
$value
;
break
;
break
;
case
'collation'
:
case
'collation'
:
$collation
=
$this
->
_parseCollation
(
$value
);
$collation
s
[]
=
$this
->
_parseCollation
(
$value
);
break
;
break
;
default
:
default
:
$suggestions
[]
=
$this
->
_parseSuggestion
(
$key
,
$value
);
$suggestions
[]
=
$this
->
_parseSuggestion
(
$key
,
$value
);
...
@@ -87,7 +87,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
...
@@ -87,7 +87,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
$index
+=
2
;
$index
+=
2
;
}
}
return
new
Solarium_Result_Select_Spellcheck
(
$suggestions
,
$collation
,
$correctlySpelled
);
return
new
Solarium_Result_Select_Spellcheck
(
$suggestions
,
$collation
s
,
$correctlySpelled
);
}
else
{
}
else
{
return
null
;
return
null
;
}
}
...
...
library/Solarium/Result/Select/Spellcheck.php
View file @
1707d4b5
...
@@ -53,11 +53,11 @@ class Solarium_Result_Select_Spellcheck implements IteratorAggregate, Countable
...
@@ -53,11 +53,11 @@ class Solarium_Result_Select_Spellcheck implements IteratorAggregate, Countable
protected
$_suggestions
;
protected
$_suggestions
;
/**
/**
* Collation object
* Collation object
array
*
*
* @var
Solarium_Result_Select_Spellcheck_Collation
* @var
array
*/
*/
protected
$_collation
;
protected
$_collation
s
;
/**
/**
* Correctly spelled?
* Correctly spelled?
...
@@ -74,21 +74,42 @@ class Solarium_Result_Select_Spellcheck implements IteratorAggregate, Countable
...
@@ -74,21 +74,42 @@ class Solarium_Result_Select_Spellcheck implements IteratorAggregate, Countable
* @param boolean $correctlySpelled
* @param boolean $correctlySpelled
* @return void
* @return void
*/
*/
public
function
__construct
(
$suggestions
,
$collation
,
$correctlySpelled
)
public
function
__construct
(
$suggestions
,
$collation
s
,
$correctlySpelled
)
{
{
$this
->
_suggestions
=
$suggestions
;
$this
->
_suggestions
=
$suggestions
;
$this
->
_collation
=
$collation
;
$this
->
_collation
s
=
$collations
;
$this
->
_correctlySpelled
=
$correctlySpelled
;
$this
->
_correctlySpelled
=
$correctlySpelled
;
}
}
/**
/**
* Get the collation result
* Get the collation result
*
*
* @param int $key
* @return Solarium_Result_Select_Spellcheck_Collation
* @return Solarium_Result_Select_Spellcheck_Collation
*/
*/
public
function
getCollation
()
public
function
getCollation
(
$key
=
null
)
{
$nrOfCollations
=
count
(
$this
->
_collations
);
if
(
$nrOfCollations
==
0
)
{
return
null
;
}
else
{
if
(
$key
===
null
)
{
$key
=
$nrOfCollations
-
1
;
// for backwards compatibility
}
return
$this
->
_collations
[
$key
];
}
}
/**
* Get all collations
*
* @return array
*/
public
function
getCollations
()
{
{
return
$this
->
_collation
;
return
$this
->
_collation
s
;
}
}
/**
/**
...
...
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