/** * Return normalized input string. * * @param string $searchString Input search string * * @return string */ public function normalizeSearchString($searchString) { $searchString = parent::normalizeSearchString($searchString); $searchString = $this->normalizeUnicodeForm($searchString); $searchString = $this->normalizeISBN($searchString); return $searchString; }
/** * Test case insensitive range normalization * * @return void */ public function testCaseInsensitiveRangeNormalization() { $lh = new LuceneSyntaxHelper(false, false); $this->assertFalse($lh->hasCaseSensitiveRanges()); $this->assertEquals('a:([b TO c] OR [B TO C])', $lh->normalizeSearchString('a:[b to c]')); }
/** * Test colon normalization * * @return void */ public function testColonNormalization() { $lh = new LuceneSyntaxHelper(false, false); $tests = ['this : that' => 'this that', 'this: that' => 'this that', 'this that:' => 'this that', ':this that' => 'this that', 'this :that' => 'this that', 'this:that' => 'this:that', 'this::::::that' => 'this:that', '"this : that"' => '"this : that"', '::::::::::::::::::::' => '']; foreach ($tests as $input => $expected) { $this->assertEquals($expected, $lh->normalizeSearchString($input)); } }