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
724c482a
Commit
724c482a
authored
Aug 15, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for highlighting multiValuedSeparatorChar param
parent
e9b8c7f4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
2 deletions
+38
-2
examples/1.2-basic-select.php
examples/1.2-basic-select.php
+1
-1
library/Solarium/QueryType/Select/Query/Component/Highlighting/Highlighting.php
...Type/Select/Query/Component/Highlighting/Highlighting.php
+21
-0
library/Solarium/QueryType/Select/RequestBuilder/Component/Highlighting.php
...ueryType/Select/RequestBuilder/Component/Highlighting.php
+1
-0
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/HighlightingTest.php
.../Select/Query/Component/Highlighting/HighlightingTest.php
+13
-1
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/HighlightingTest.php
...Type/Select/RequestBuilder/Component/HighlightingTest.php
+2
-0
No files found.
examples/1.2-basic-select.php
View file @
724c482a
...
...
@@ -7,7 +7,7 @@ htmlHeader();
$client
=
new
Solarium\Client
(
$config
);
// get a select query instance
$query
=
$client
->
createQuery
(
$client
::
QUERY_SELECT
);
$query
=
$client
->
createQuery
(
$client
::
QUERY_SELECT
,
array
(
'responsewriter'
=>
'phps'
)
);
// this executes the query and returns the result
$resultset
=
$client
->
execute
(
$query
);
...
...
library/Solarium/QueryType/Select/Query/Component/Highlighting/Highlighting.php
View file @
724c482a
...
...
@@ -754,4 +754,25 @@ class Highlighting extends Component
return
$this
->
getOption
(
'phraselimit'
);
}
/**
* Set MultiValuedSeparatorChar option
*
* @param string $separator
* @return self Provides fluent interface
*/
public
function
setMultiValuedSeparatorChar
(
$separator
)
{
return
$this
->
setOption
(
'multivaluedseparatorchar'
,
$separator
);
}
/**
* Get MultiValuedSeparatorChar option
*
* @return $separator
*/
public
function
getMultiValuedSeparatorChar
()
{
return
$this
->
getOption
(
'multivaluedseparatorchar'
);
}
}
library/Solarium/QueryType/Select/RequestBuilder/Component/Highlighting.php
View file @
724c482a
...
...
@@ -84,6 +84,7 @@ class Highlighting
$request
->
addParam
(
'hl.regex.maxAnalyzedChars'
,
$component
->
getRegexMaxAnalyzedChars
());
$request
->
addParam
(
'hl.q'
,
$component
->
getQuery
());
$request
->
addParam
(
'hl.phraseLimit'
,
$component
->
getPhraseLimit
());
$request
->
addParam
(
'hl.multiValuedSeparatorChar'
,
$component
->
getMultiValuedSeparatorChar
());
// set per-field highlighting params
foreach
(
$component
->
getFields
()
as
$field
)
{
...
...
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/HighlightingTest.php
View file @
724c482a
...
...
@@ -80,7 +80,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'regexmaxanalyzedchars'
=>
500
,
'query'
=>
'text:myvalue'
,
'phraselimit'
=>
35
,
'multivaluedseparatorchar'
=>
'|'
,
);
$this
->
hlt
->
setOptions
(
$options
);
...
...
@@ -111,6 +111,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$options
[
'regexmaxanalyzedchars'
],
$this
->
hlt
->
getRegexMaxAnalyzedChars
());
$this
->
assertEquals
(
$options
[
'query'
],
$this
->
hlt
->
getQuery
());
$this
->
assertEquals
(
$options
[
'phraselimit'
],
$this
->
hlt
->
getPhraseLimit
());
$this
->
assertEquals
(
$options
[
'multivaluedseparatorchar'
],
$this
->
hlt
->
getMultiValuedSeparatorChar
());
}
public
function
testGetType
()
...
...
@@ -513,4 +514,15 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
);
}
public
function
testSetAndGetMultiValuedSeparatorChar
()
{
$value
=
'|'
;
$this
->
hlt
->
setMultiValuedSeparatorChar
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
hlt
->
getMultiValuedSeparatorChar
()
);
}
}
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/HighlightingTest.php
View file @
724c482a
...
...
@@ -79,6 +79,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$component
->
setPhraseLimit
(
40
);
$component
->
setTagPrefix
(
'<i>'
);
$component
->
setTagPostfix
(
'</i>'
);
$component
->
setMultiValuedSeparatorChar
(
'|'
);
$request
=
$builder
->
buildComponent
(
$component
,
$request
);
...
...
@@ -108,6 +109,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'hl.regex.pattern'
=>
'mypattern'
,
'hl.q'
=>
'text:myvalue'
,
'hl.phraseLimit'
=>
40
,
'hl.multiValuedSeparatorChar'
=>
'|'
,
'f.fieldB.hl.snippets'
=>
3
,
'f.fieldB.hl.fragsize'
=>
25
,
'f.fieldB.hl.mergeContiguous'
=>
'true'
,
...
...
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