Пример #1
0
 public function testTostring()
 {
     $oGroup = new Sequin\Query(new Sequin\Term('foo'));
     $oGroup->andRight(new Sequin\Term('bar'));
     $this->assertEquals('(foo) AND bar', $oGroup->toString());
     $oLeftTerm = new Sequin\Term('foo');
     $oLeftTerm->andRight(new Sequin\Term('bar'));
     $oGroup = new Sequin\Query($oLeftTerm);
     $oGroup->orRight(new Sequin\Term('baz'));
     $this->assertEquals('(foo AND bar) OR baz', $oGroup->toString());
     $oLeftTerm = new Sequin\Term('foo');
     $oLeftTerm->andRight(new Sequin\Term('bar'));
     $oGroup = new Sequin\Query($oLeftTerm, 'fieldName', 3);
     $oGroup->orRight(new Sequin\Term('baz'));
     $this->assertEquals('fieldName:(foo AND bar)^3 OR baz', $oGroup->toString());
 }
Пример #2
0
 public function testTermsCanBeJoinedByChainingMethodCalls()
 {
     $oTerm = new Sequin\Term('foo');
     $oTerm->andRight(new Sequin\Term('bar'))->orRight(new Sequin\Term('baz'))->notRight(new Sequin\Term('bip'));
     $this->assertEquals('foo AND bar OR baz NOT bip', $oTerm->toString());
 }