Ejemplo n.º 1
0
 /**
  * Add request settings for Highlighting
  *
  * @param Solarium_Query_Select_Component_Highlighting $component
  * @param Solarium_Client_Request $request
  * @return Solarium_Client_Request
  */
 public function build($component, $request)
 {
     // enable highlighting
     $request->addParam('hl', 'true');
     $request->addParam('hl.fl', $component->getFields());
     $request->addParam('hl.snippets', $component->getSnippets());
     $request->addParam('hl.fragsize', $component->getFragSize());
     $request->addParam('hl.mergeContiguous', $component->getMergeContiguous());
     $request->addParam('hl.requireFieldMatch', $component->getRequireFieldMatch());
     $request->addParam('hl.maxAnalyzedChars', $component->getMaxAnalyzedChars());
     $request->addParam('hl.alternateField', $component->getAlternateField());
     $request->addParam('hl.maxAlternateFieldLength', $component->getMaxAlternateFieldLength());
     $request->addParam('hl.formatter', $component->getFormatter());
     $request->addParam('hl.simple.pre', $component->getSimplePrefix());
     $request->addParam('hl.simple.post', $component->getSimplePostfix());
     $request->addParam('hl.fragmenter', $component->getFragmenter());
     $request->addParam('hl.fragListBuilder', $component->getFragListBuilder());
     $request->addParam('hl.fragmentsBuilder', $component->getFragmentsBuilder());
     $request->addParam('hl.useFastVectorHighlighter', $component->getUseFastVectorHighlighter());
     $request->addParam('hl.usePhraseHighlighter', $component->getUsePhraseHighlighter());
     $request->addParam('hl.highlightMultiTerm', $component->getHighlightMultiTerm());
     $request->addParam('hl.regex.slop', $component->getRegexSlop());
     $request->addParam('hl.regex.pattern', $component->getRegexPattern());
     $request->addParam('hl.regex.maxAnalyzedChars', $component->getRegexMaxAnalyzedChars());
     return $request;
 }
Ejemplo n.º 2
0
 /**
  * Add request settings for Highlighting
  *
  * @param Solarium_Query_Select_Component_Highlighting $component
  * @param Solarium_Client_Request $request
  * @return Solarium_Client_Request
  */
 public function build(Solarium_Query_Select_Component_Highlighting $component, Solarium_Client_Request $request)
 {
     // enable highlighting
     $request->addParam('hl', 'true');
     // set global highlighting params
     $request->addParam('hl.fl', implode(',', array_keys($component->getFields())));
     $request->addParam('hl.snippets', $component->getSnippets());
     $request->addParam('hl.fragsize', $component->getFragSize());
     $request->addParam('hl.mergeContiguous', $component->getMergeContiguous());
     $request->addParam('hl.requireFieldMatch', $component->getRequireFieldMatch());
     $request->addParam('hl.maxAnalyzedChars', $component->getMaxAnalyzedChars());
     $request->addParam('hl.alternateField', $component->getAlternateField());
     $request->addParam('hl.maxAlternateFieldLength', $component->getMaxAlternateFieldLength());
     $request->addParam('hl.formatter', $component->getFormatter());
     $request->addParam('hl.simple.pre', $component->getSimplePrefix());
     $request->addParam('hl.simple.post', $component->getSimplePostfix());
     $request->addParam('hl.fragmenter', $component->getFragmenter());
     $request->addParam('hl.fragListBuilder', $component->getFragListBuilder());
     $request->addParam('hl.fragmentsBuilder', $component->getFragmentsBuilder());
     $request->addParam('hl.useFastVectorHighlighter', $component->getUseFastVectorHighlighter());
     $request->addParam('hl.usePhraseHighlighter', $component->getUsePhraseHighlighter());
     $request->addParam('hl.highlightMultiTerm', $component->getHighlightMultiTerm());
     $request->addParam('hl.regex.slop', $component->getRegexSlop());
     $request->addParam('hl.regex.pattern', $component->getRegexPattern());
     $request->addParam('hl.regex.maxAnalyzedChars', $component->getRegexMaxAnalyzedChars());
     // set per-field highlighting params
     foreach ($component->getFields() as $field) {
         $this->_addFieldParams($field, $request);
     }
     return $request;
 }
 public function testSetAndGetRequireFieldMatch()
 {
     $value = true;
     $this->_hlt->setRequireFieldMatch($value);
     $this->assertEquals($value, $this->_hlt->getRequireFieldMatch());
 }