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
b08a014d
Commit
b08a014d
authored
Jul 16, 2014
by
Michel Oleynik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds support for hl.preserveMulti and option. This fixes #263.
parent
960d1549
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
0 deletions
+76
-0
library/Solarium/QueryType/Select/Query/Component/Highlighting/Field.php
...m/QueryType/Select/Query/Component/Highlighting/Field.php
+21
-0
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
+2
-0
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/FieldTest.php
...eryType/Select/Query/Component/Highlighting/FieldTest.php
+13
-0
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/HighlightingTest.php
.../Select/Query/Component/Highlighting/HighlightingTest.php
+13
-0
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/HighlightingTest.php
...Type/Select/RequestBuilder/Component/HighlightingTest.php
+6
-0
No files found.
library/Solarium/QueryType/Select/Query/Component/Highlighting/Field.php
View file @
b08a014d
...
@@ -168,6 +168,27 @@ class Field extends Configurable
...
@@ -168,6 +168,27 @@ class Field extends Configurable
return
$this
->
getOption
(
'alternatefield'
);
return
$this
->
getOption
(
'alternatefield'
);
}
}
/**
* Set preserveMulti option
*
* @param boolean $preservemulti
* @return self Provides fluent interface
*/
public
function
setPreserveMulti
(
$preservemulti
)
{
return
$this
->
setOption
(
'preservemulti'
,
$preservemulti
);
}
/**
* Get preserveMulti option
*
* @return boolean|null
*/
public
function
getPreserveMulti
()
{
return
$this
->
getOption
(
'preservemulti'
);
}
/**
/**
* Set formatter option
* Set formatter option
*
*
...
...
library/Solarium/QueryType/Select/Query/Component/Highlighting/Highlighting.php
View file @
b08a014d
...
@@ -420,6 +420,27 @@ class Highlighting extends Component
...
@@ -420,6 +420,27 @@ class Highlighting extends Component
return
$this
->
getOption
(
'maxalternatefieldlength'
);
return
$this
->
getOption
(
'maxalternatefieldlength'
);
}
}
/**
* Set preserveMulti option
*
* @param boolean $preservemulti
* @return self Provides fluent interface
*/
public
function
setPreserveMulti
(
$preservemulti
)
{
return
$this
->
setOption
(
'preservemulti'
,
$preservemulti
);
}
/**
* Get preserveMulti option
*
* @return boolean|null
*/
public
function
getPreserveMulti
()
{
return
$this
->
getOption
(
'preservemulti'
);
}
/**
/**
* Set formatter option
* Set formatter option
*
*
...
...
library/Solarium/QueryType/Select/RequestBuilder/Component/Highlighting.php
View file @
b08a014d
...
@@ -70,6 +70,7 @@ class Highlighting implements ComponentRequestBuilderInterface
...
@@ -70,6 +70,7 @@ class Highlighting implements ComponentRequestBuilderInterface
$request
->
addParam
(
'hl.maxAnalyzedChars'
,
$component
->
getMaxAnalyzedChars
());
$request
->
addParam
(
'hl.maxAnalyzedChars'
,
$component
->
getMaxAnalyzedChars
());
$request
->
addParam
(
'hl.alternateField'
,
$component
->
getAlternateField
());
$request
->
addParam
(
'hl.alternateField'
,
$component
->
getAlternateField
());
$request
->
addParam
(
'hl.maxAlternateFieldLength'
,
$component
->
getMaxAlternateFieldLength
());
$request
->
addParam
(
'hl.maxAlternateFieldLength'
,
$component
->
getMaxAlternateFieldLength
());
$request
->
addParam
(
'hl.preserveMulti'
,
$component
->
getPreserveMulti
());
$request
->
addParam
(
'hl.formatter'
,
$component
->
getFormatter
());
$request
->
addParam
(
'hl.formatter'
,
$component
->
getFormatter
());
$request
->
addParam
(
'hl.simple.pre'
,
$component
->
getSimplePrefix
());
$request
->
addParam
(
'hl.simple.pre'
,
$component
->
getSimplePrefix
());
$request
->
addParam
(
'hl.simple.post'
,
$component
->
getSimplePostfix
());
$request
->
addParam
(
'hl.simple.post'
,
$component
->
getSimplePostfix
());
...
@@ -115,6 +116,7 @@ class Highlighting implements ComponentRequestBuilderInterface
...
@@ -115,6 +116,7 @@ class Highlighting implements ComponentRequestBuilderInterface
$request
->
addParam
(
$prefix
.
'fragsize'
,
$field
->
getFragSize
());
$request
->
addParam
(
$prefix
.
'fragsize'
,
$field
->
getFragSize
());
$request
->
addParam
(
$prefix
.
'mergeContiguous'
,
$field
->
getMergeContiguous
());
$request
->
addParam
(
$prefix
.
'mergeContiguous'
,
$field
->
getMergeContiguous
());
$request
->
addParam
(
$prefix
.
'alternateField'
,
$field
->
getAlternateField
());
$request
->
addParam
(
$prefix
.
'alternateField'
,
$field
->
getAlternateField
());
$request
->
addParam
(
$prefix
.
'preserveMulti'
,
$field
->
getPreserveMulti
());
$request
->
addParam
(
$prefix
.
'formatter'
,
$field
->
getFormatter
());
$request
->
addParam
(
$prefix
.
'formatter'
,
$field
->
getFormatter
());
$request
->
addParam
(
$prefix
.
'simple.pre'
,
$field
->
getSimplePrefix
());
$request
->
addParam
(
$prefix
.
'simple.pre'
,
$field
->
getSimplePrefix
());
$request
->
addParam
(
$prefix
.
'simple.post'
,
$field
->
getSimplePostfix
());
$request
->
addParam
(
$prefix
.
'simple.post'
,
$field
->
getSimplePostfix
());
...
...
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/FieldTest.php
View file @
b08a014d
...
@@ -54,6 +54,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -54,6 +54,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
'fragsize'
=>
25
,
'fragsize'
=>
25
,
'mergecontiguous'
=>
true
,
'mergecontiguous'
=>
true
,
'alternatefield'
=>
'text'
,
'alternatefield'
=>
'text'
,
'preservemulti'
=>
true
,
'formatter'
=>
'myFormatter'
,
'formatter'
=>
'myFormatter'
,
'simpleprefix'
=>
'<b>'
,
'simpleprefix'
=>
'<b>'
,
'simplepostfix'
=>
'</b>'
,
'simplepostfix'
=>
'</b>'
,
...
@@ -67,6 +68,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -67,6 +68,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
25
,
$this
->
fld
->
getFragSize
());
$this
->
assertEquals
(
25
,
$this
->
fld
->
getFragSize
());
$this
->
assertEquals
(
true
,
$this
->
fld
->
getMergeContiguous
());
$this
->
assertEquals
(
true
,
$this
->
fld
->
getMergeContiguous
());
$this
->
assertEquals
(
'text'
,
$this
->
fld
->
getAlternateField
());
$this
->
assertEquals
(
'text'
,
$this
->
fld
->
getAlternateField
());
$this
->
assertEquals
(
true
,
$this
->
fld
->
getPreserveMulti
());
$this
->
assertEquals
(
'myFormatter'
,
$this
->
fld
->
getFormatter
());
$this
->
assertEquals
(
'myFormatter'
,
$this
->
fld
->
getFormatter
());
$this
->
assertEquals
(
'<b>'
,
$this
->
fld
->
getSimplePrefix
());
$this
->
assertEquals
(
'<b>'
,
$this
->
fld
->
getSimplePrefix
());
$this
->
assertEquals
(
'</b>'
,
$this
->
fld
->
getSimplePostfix
());
$this
->
assertEquals
(
'</b>'
,
$this
->
fld
->
getSimplePostfix
());
...
@@ -129,6 +131,17 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -129,6 +131,17 @@ class FieldTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testSetAndGetPreserveMulti
()
{
$value
=
true
;
$this
->
fld
->
setPreserveMulti
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
fld
->
getPreserveMulti
()
);
}
public
function
testSetAndGetFormatter
()
public
function
testSetAndGetFormatter
()
{
{
$this
->
fld
->
setFormatter
();
$this
->
fld
->
setFormatter
();
...
...
tests/Solarium/Tests/QueryType/Select/Query/Component/Highlighting/HighlightingTest.php
View file @
b08a014d
...
@@ -64,6 +64,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -64,6 +64,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'maxanalyzedchars'
=>
40
,
'maxanalyzedchars'
=>
40
,
'alternatefield'
=>
'text'
,
'alternatefield'
=>
'text'
,
'maxalternatefieldlength'
=>
50
,
'maxalternatefieldlength'
=>
50
,
'preservemulti'
=>
true
,
'formatter'
=>
'myFormatter'
,
'formatter'
=>
'myFormatter'
,
'simpleprefix'
=>
'<b>'
,
'simpleprefix'
=>
'<b>'
,
'simplepostfix'
=>
'</b>'
,
'simplepostfix'
=>
'</b>'
,
...
@@ -100,6 +101,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -100,6 +101,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$options
[
'maxanalyzedchars'
],
$this
->
hlt
->
getMaxAnalyzedChars
());
$this
->
assertEquals
(
$options
[
'maxanalyzedchars'
],
$this
->
hlt
->
getMaxAnalyzedChars
());
$this
->
assertEquals
(
$options
[
'alternatefield'
],
$this
->
hlt
->
getAlternateField
());
$this
->
assertEquals
(
$options
[
'alternatefield'
],
$this
->
hlt
->
getAlternateField
());
$this
->
assertEquals
(
$options
[
'maxalternatefieldlength'
],
$this
->
hlt
->
getMaxAlternateFieldLength
());
$this
->
assertEquals
(
$options
[
'maxalternatefieldlength'
],
$this
->
hlt
->
getMaxAlternateFieldLength
());
$this
->
assertEquals
(
$options
[
'preservemulti'
],
$this
->
hlt
->
getPreserveMulti
());
$this
->
assertEquals
(
$options
[
'formatter'
],
$this
->
hlt
->
getFormatter
());
$this
->
assertEquals
(
$options
[
'formatter'
],
$this
->
hlt
->
getFormatter
());
$this
->
assertEquals
(
$options
[
'simpleprefix'
],
$this
->
hlt
->
getSimplePrefix
());
$this
->
assertEquals
(
$options
[
'simpleprefix'
],
$this
->
hlt
->
getSimplePrefix
());
$this
->
assertEquals
(
$options
[
'simplepostfix'
],
$this
->
hlt
->
getSimplePostfix
());
$this
->
assertEquals
(
$options
[
'simplepostfix'
],
$this
->
hlt
->
getSimplePostfix
());
...
@@ -355,6 +357,17 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -355,6 +357,17 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testSetAndGetPreserveMulti
()
{
$value
=
true
;
$this
->
hlt
->
setPreserveMulti
(
$value
);
$this
->
assertEquals
(
$value
,
$this
->
hlt
->
getPreserveMulti
()
);
}
public
function
testSetAndGetFormatter
()
public
function
testSetAndGetFormatter
()
{
{
$this
->
hlt
->
setFormatter
();
$this
->
hlt
->
setFormatter
();
...
...
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/HighlightingTest.php
View file @
b08a014d
...
@@ -50,6 +50,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -50,6 +50,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$field
->
setFragSize
(
25
);
$field
->
setFragSize
(
25
);
$field
->
setMergeContiguous
(
true
);
$field
->
setMergeContiguous
(
true
);
$field
->
setAlternateField
(
'text'
);
$field
->
setAlternateField
(
'text'
);
$field
->
setPreserveMulti
(
true
);
$field
->
setFormatter
(
'myFormatter'
);
$field
->
setFormatter
(
'myFormatter'
);
$field
->
setSimplePrefix
(
'<b>'
);
$field
->
setSimplePrefix
(
'<b>'
);
$field
->
setSimplePostfix
(
'</b>'
);
$field
->
setSimplePostfix
(
'</b>'
);
...
@@ -63,6 +64,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -63,6 +64,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$component
->
setMaxAnalyzedChars
(
4
);
$component
->
setMaxAnalyzedChars
(
4
);
$component
->
setAlternateField
(
'fieldC'
);
$component
->
setAlternateField
(
'fieldC'
);
$component
->
setMaxAlternateFieldLength
(
5
);
$component
->
setMaxAlternateFieldLength
(
5
);
$component
->
setPreserveMulti
(
true
);
$component
->
setFormatter
(
'simple'
);
$component
->
setFormatter
(
'simple'
);
$component
->
setSimplePrefix
(
'<b>'
);
$component
->
setSimplePrefix
(
'<b>'
);
$component
->
setSimplePostfix
(
'</b>'
);
$component
->
setSimplePostfix
(
'</b>'
);
...
@@ -99,6 +101,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -99,6 +101,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'hl.maxAnalyzedChars'
=>
100
,
'hl.maxAnalyzedChars'
=>
100
,
'hl.alternateField'
=>
'fieldC'
,
'hl.alternateField'
=>
'fieldC'
,
'hl.maxAlternateFieldLength'
=>
5
,
'hl.maxAlternateFieldLength'
=>
5
,
'hl.preserveMulti'
=>
'true'
,
'hl.formatter'
=>
'simple'
,
'hl.formatter'
=>
'simple'
,
'hl.simple.pre'
=>
'<b>'
,
'hl.simple.pre'
=>
'<b>'
,
'hl.simple.post'
=>
'</b>'
,
'hl.simple.post'
=>
'</b>'
,
...
@@ -119,6 +122,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -119,6 +122,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'f.fieldB.hl.fragsize'
=>
25
,
'f.fieldB.hl.fragsize'
=>
25
,
'f.fieldB.hl.mergeContiguous'
=>
'true'
,
'f.fieldB.hl.mergeContiguous'
=>
'true'
,
'f.fieldB.hl.alternateField'
=>
'text'
,
'f.fieldB.hl.alternateField'
=>
'text'
,
'f.fieldB.hl.preserveMulti'
=>
'true'
,
'f.fieldB.hl.formatter'
=>
'myFormatter'
,
'f.fieldB.hl.formatter'
=>
'myFormatter'
,
'f.fieldB.hl.simple.pre'
=>
'<b>'
,
'f.fieldB.hl.simple.pre'
=>
'<b>'
,
'f.fieldB.hl.simple.post'
=>
'</b>'
,
'f.fieldB.hl.simple.post'
=>
'</b>'
,
...
@@ -148,6 +152,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -148,6 +152,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$component
->
setMaxAnalyzedChars
(
4
);
$component
->
setMaxAnalyzedChars
(
4
);
$component
->
setAlternateField
(
'fieldC'
);
$component
->
setAlternateField
(
'fieldC'
);
$component
->
setMaxAlternateFieldLength
(
5
);
$component
->
setMaxAlternateFieldLength
(
5
);
$component
->
setPreserveMulti
(
true
);
$component
->
setFormatter
(
'simple'
);
$component
->
setFormatter
(
'simple'
);
$component
->
setSimplePrefix
(
'<b>'
);
$component
->
setSimplePrefix
(
'<b>'
);
$component
->
setSimplePostfix
(
'</b>'
);
$component
->
setSimplePostfix
(
'</b>'
);
...
@@ -183,6 +188,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -183,6 +188,7 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'hl.maxAnalyzedChars'
=>
100
,
'hl.maxAnalyzedChars'
=>
100
,
'hl.alternateField'
=>
'fieldC'
,
'hl.alternateField'
=>
'fieldC'
,
'hl.maxAlternateFieldLength'
=>
5
,
'hl.maxAlternateFieldLength'
=>
5
,
'hl.preserveMulti'
=>
'true'
,
'hl.formatter'
=>
'simple'
,
'hl.formatter'
=>
'simple'
,
'hl.simple.pre'
=>
'<b>'
,
'hl.simple.pre'
=>
'<b>'
,
'hl.simple.post'
=>
'</b>'
,
'hl.simple.post'
=>
'</b>'
,
...
...
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