Commit 724c482a authored by Bas de Nooijer's avatar Bas de Nooijer

Added support for highlighting multiValuedSeparatorChar param

parent e9b8c7f4
......@@ -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);
......
......@@ -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');
}
}
......@@ -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) {
......
......@@ -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()
);
}
}
......@@ -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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment