$p->fail('(foo'); $p->fail('foo)))'); // This parts gets a little confusing because of the different notations. // xfCriterionRange uses the mathematical: [] is inclusive, () is exclusive // Lucene syntax uses its own: [] is inclusive, {} is exclusive $t->diag('Range'); $p->pass('{1 to 3}', 'RANGE {(1,3)}'); $p->pass('[1 to 3]', 'RANGE {[1,3]}'); $p->pass('{1 to 3]', 'RANGE {(1,3]}'); $p->pass('[1 to 3}', 'RANGE {[1,3)}'); $p->pass('foo: [1 to 40]', 'FIELD {foo IS RANGE {[1,40]}}'); $p->pass('foo [1 to 40] bar', 'BOOLEAN {[foo] AND [RANGE {[1,40]}] AND [bar]}'); $p->fail('['); $p->fail('[1'); $p->fail('[1 to'); $p->fail('[1 to 3'); $t->diag('Wildcard'); $p->pass('m*n', 'WILDCARD {m*n}'); $p->pass('m?n', 'WILDCARD {m?n}'); $p->pass('t*s?', 'WILDCARD {t*s?}'); $t->diag('Special Characters'); $p->pass('\\+foo', '+foo'); $p->pass('\\-foo', '-foo'); $t->diag('Default Slop'); $t->is($parser->getPhraseSlop(), 0, '->getPhraseSlop() returns the default phrase slop'); $parser->setPhraseSlop(2); $t->is($parser->getPhraseSlop(), 2, '->setPhraseSlop() changes the default phrase slop'); $p->pass('"foo bar"', 'PHRASE {"foo bar" SLOP 2}'); $p->pass('"foo bar"~1', 'PHRASE {"foo bar" SLOP 1}'); $p->pass('"foo bar"~0', 'PHRASE {"foo bar"}'); $p->stats();