예제 #1
0
 /**
  * @group Slow
  * @slowExecutionTime 0.07784 ms
  * @covers Wikia\Search\Field\FieldExpression::getFieldValueString
  * @covers Wikia\Search\Field\FieldExpression::setValueQuote
  */
 public function testQuoting()
 {
     $field = new Field\Field('foo', 'en');
     $expr = new Field\FieldExpression($field, array('value' => 'bar'));
     $this->assertEquals("(foo:bar)", $expr->__toString());
     $expr->setValueQuote('"');
     $this->assertEquals('(foo:"bar")', $expr->__toString());
 }
예제 #2
0
 /**
  * Used to compose field name, value, boosts, and quotes in support of dynamic language fields
  * @param  string $field
  * @param  string $value
  * @param  array  $params
  * @return string the lucene-ready string
  **/
 public static function valueForField($field, $value, array $params = array())
 {
     $expression = new Field\FieldExpression(new Field\Field($field), array_merge(array('value' => $value), $params));
     return $expression->__toString();
 }