Commit a7ff6fa6 authored by Bas de Nooijer's avatar Bas de Nooijer

Merge branch 'develop' into feature/nextgen

parents f25ca7e7 6981a90c
...@@ -467,6 +467,57 @@ class Highlighting extends Component ...@@ -467,6 +467,57 @@ class Highlighting extends Component
{ {
return $this->getOption('simplepostfix'); return $this->getOption('simplepostfix');
} }
/**
* Set tag prefix option
*
* Solr option h1.tag.post
*
* @param string $prefix
* @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
*/
public function setTagPrefix($prefix)
{
return $this->_setOption('tagprefix', $prefix);
}
/**
* Get tag prefix option
*
* Solr option hl.tag.pre
*
* @return string|null
*/
public function getTagPrefix()
{
return $this->getOption('tagprefix');
}
/**
* Set tag postfix option
*
* Solr option h1.tag.post
*
* @param string $postfix
* @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
*/
public function setTagPostfix($postfix)
{
return $this->_setOption('tagpostfix', $postfix);
}
/**
* Get tag postfix option
*
* Solr option hl.tag.post
*
* @return string|null
*/
public function getTagPostfix()
{
return $this->getOption('tagpostfix');
}
/** /**
* Set fragmenter option * Set fragmenter option
......
...@@ -71,6 +71,8 @@ class Highlighting ...@@ -71,6 +71,8 @@ class Highlighting
$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());
$request->addParam('hl.tag.pre', $component->getTagPrefix());
$request->addParam('hl.tag.post', $component->getTagPostfix());
$request->addParam('hl.fragmenter', $component->getFragmenter()); $request->addParam('hl.fragmenter', $component->getFragmenter());
$request->addParam('hl.fragListBuilder', $component->getFragListBuilder()); $request->addParam('hl.fragListBuilder', $component->getFragListBuilder());
$request->addParam('hl.fragmentsBuilder', $component->getFragmentsBuilder()); $request->addParam('hl.fragmentsBuilder', $component->getFragmentsBuilder());
......
...@@ -487,4 +487,26 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase ...@@ -487,4 +487,26 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
); );
} }
public function testSetAndGetTagPrefix()
{
$value = '<i>';
$this->_hlt->setTagPrefix($value);
$this->assertEquals(
$value,
$this->_hlt->getTagPrefix()
);
}
public function testSetAndGetTagPostfix()
{
$value = '</i>';
$this->_hlt->setTagPostfix($value);
$this->assertEquals(
$value,
$this->_hlt->getTagPostfix()
);
}
} }
...@@ -77,6 +77,8 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase ...@@ -77,6 +77,8 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$component->setMaxAnalyzedChars(100); $component->setMaxAnalyzedChars(100);
$component->setQuery('text:myvalue'); $component->setQuery('text:myvalue');
$component->setPhraseLimit(40); $component->setPhraseLimit(40);
$component->setTagPrefix('<i>');
$component->setTagPostfix('</i>');
$request = $builder->buildComponent($component, $request); $request = $builder->buildComponent($component, $request);
...@@ -94,6 +96,8 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase ...@@ -94,6 +96,8 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
'hl.formatter' => 'simple', 'hl.formatter' => 'simple',
'hl.simple.pre' => '<b>', 'hl.simple.pre' => '<b>',
'hl.simple.post' => '</b>', 'hl.simple.post' => '</b>',
'hl.tag.pre' => '<i>',
'hl.tag.post' => '</i>',
'hl.fragmenter' => 'myFragmenter', 'hl.fragmenter' => 'myFragmenter',
'hl.fragListBuilder' => 'myFragListBuilder', 'hl.fragListBuilder' => 'myFragListBuilder',
'hl.fragmentsBuilder' => 'myFragmentsBuilder', 'hl.fragmentsBuilder' => 'myFragmentsBuilder',
......
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