예제 #1
0
 public function testConfigMode()
 {
     $options = array('field' => array('fieldA' => array('snippets' => 3, 'fragsize' => 25), 'fieldB'), 'snippets' => 2, 'fragsize' => 20, 'mergecontiguous' => true, 'requirefieldmatch' => false, 'maxanalyzedchars' => 40, 'alternatefield' => 'text', 'maxalternatefieldlength' => 50, 'preservemulti' => true, 'formatter' => 'myFormatter', 'simpleprefix' => '<b>', 'simplepostfix' => '</b>', 'tagprefix' => '<i>', 'tagpostfix' => '<\\i>', 'fragmenter' => 'myFragmenter', 'fraglistbuilder' => 'regex', 'fragmentsbuilder' => 'myBuilder', 'usefastvectorhighlighter' => true, 'usephrasehighlighter' => false, 'highlightmultiterm' => true, 'regexslop' => 0.8, 'regexpattern' => 'myPattern', 'regexmaxanalyzedchars' => 500, 'query' => 'text:myvalue', 'phraselimit' => 35, 'multivaluedseparatorchar' => '|', 'boundaryscannermaxscan' => 12, 'boundaryscannerchars' => "\t\n", 'boundaryscannertype' => 'LINE', 'boundaryscannerlanguage' => 'nl', 'boundaryscannercountry' => 'NL');
     $this->hlt->setOptions($options);
     $this->assertEquals(array('fieldA', 'fieldB'), array_keys($this->hlt->getFields()));
     $this->assertEquals($options['field']['fieldA']['snippets'], $this->hlt->getField('fieldA')->getSnippets());
     $this->assertEquals($options['field']['fieldA']['fragsize'], $this->hlt->getField('fieldA')->getFragSize());
     $this->assertEquals(null, $this->hlt->getField('FieldB')->getSnippets());
     $this->assertEquals($options['snippets'], $this->hlt->getSnippets());
     $this->assertEquals($options['fragsize'], $this->hlt->getFragSize());
     $this->assertEquals($options['mergecontiguous'], $this->hlt->getMergeContiguous());
     $this->assertEquals($options['maxanalyzedchars'], $this->hlt->getMaxAnalyzedChars());
     $this->assertEquals($options['alternatefield'], $this->hlt->getAlternateField());
     $this->assertEquals($options['maxalternatefieldlength'], $this->hlt->getMaxAlternateFieldLength());
     $this->assertEquals($options['preservemulti'], $this->hlt->getPreserveMulti());
     $this->assertEquals($options['formatter'], $this->hlt->getFormatter());
     $this->assertEquals($options['simpleprefix'], $this->hlt->getSimplePrefix());
     $this->assertEquals($options['simplepostfix'], $this->hlt->getSimplePostfix());
     $this->assertEquals($options['tagprefix'], $this->hlt->getTagPrefix());
     $this->assertEquals($options['tagpostfix'], $this->hlt->getTagPostfix());
     $this->assertEquals($options['fragmenter'], $this->hlt->getFragmenter());
     $this->assertEquals($options['fraglistbuilder'], $this->hlt->getFragListBuilder());
     $this->assertEquals($options['fragmentsbuilder'], $this->hlt->getFragmentsBuilder());
     $this->assertEquals($options['usefastvectorhighlighter'], $this->hlt->getUseFastVectorHighlighter());
     $this->assertEquals($options['usephrasehighlighter'], $this->hlt->getUsePhraseHighlighter());
     $this->assertEquals($options['highlightmultiterm'], $this->hlt->getHighlightMultiTerm());
     $this->assertEquals($options['regexslop'], $this->hlt->getRegexSlop());
     $this->assertEquals($options['regexpattern'], $this->hlt->getRegexPattern());
     $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());
     $this->assertEquals($options['boundaryscannermaxscan'], $this->hlt->getBoundaryScannerMaxScan());
     $this->assertEquals($options['boundaryscannerchars'], $this->hlt->getBoundaryScannerChars());
     $this->assertEquals($options['boundaryscannertype'], $this->hlt->getBoundaryScannerType());
     $this->assertEquals($options['boundaryscannerlanguage'], $this->hlt->getBoundaryScannerLanguage());
     $this->assertEquals($options['boundaryscannercountry'], $this->hlt->getBoundaryScannerCountry());
 }