Skip to content

Commit

Permalink
Added support for highlighting multiValuedSeparatorChar param
Browse files Browse the repository at this point in the history
  • Loading branch information
basdenooijer committed Aug 15, 2012
1 parent e9b8c7f commit 724c482
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/1.2-basic-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,4 +754,25 @@ public function getPhraseLimit()
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');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function buildComponent(HighlightingComponent $component, Request $reques
$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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testConfigMode()
'regexmaxanalyzedchars' => 500,
'query' => 'text:myvalue',
'phraselimit' => 35,

'multivaluedseparatorchar' => '|',
);

$this->hlt->setOptions($options);
Expand Down Expand Up @@ -111,6 +111,7 @@ public function testConfigMode()
$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()
Expand Down Expand Up @@ -513,4 +514,15 @@ public function testSetAndGetTagPostfix()
);
}

public function testSetAndGetMultiValuedSeparatorChar()
{
$value = '|';
$this->hlt->setMultiValuedSeparatorChar($value);

$this->assertEquals(
$value,
$this->hlt->getMultiValuedSeparatorChar()
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function testBuildComponent()
$component->setPhraseLimit(40);
$component->setTagPrefix('<i>');
$component->setTagPostfix('</i>');
$component->setMultiValuedSeparatorChar('|');

$request = $builder->buildComponent($component, $request);

Expand Down Expand Up @@ -108,6 +109,7 @@ public function testBuildComponent()
'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',
Expand Down

0 comments on commit 724c482

Please sign in to comment.