Exemple #1
0
 public function testConfigMode()
 {
     $options = array('key' => 'myKey', 'exclude' => array('e1', 'e2'), 'field' => 'text', 'sort' => 'index', 'limit' => 10, 'offset' => 20, 'mincount' => 5, 'missing' => true, 'method' => 'enum');
     $this->facet->setOptions($options);
     $this->assertEquals($options['key'], $this->facet->getKey());
     $this->assertEquals($options['exclude'], $this->facet->getExcludes());
     $this->assertEquals($options['field'], $this->facet->getField());
     $this->assertEquals($options['sort'], $this->facet->getSort());
     $this->assertEquals($options['limit'], $this->facet->getLimit());
     $this->assertEquals($options['offset'], $this->facet->getOffset());
     $this->assertEquals($options['mincount'], $this->facet->getMinCount());
     $this->assertEquals($options['missing'], $this->facet->getMissing());
     $this->assertEquals($options['method'], $this->facet->getMethod());
 }
Exemple #2
0
 /**
  * Add params for a field facet to request
  *
  * @param  Request    $request
  * @param  FacetField $facet
  * @return void
  */
 public function addFacetField($request, $facet)
 {
     $field = $facet->getField();
     $request->addParam('facet.field', $this->renderLocalParams($field, array('key' => $facet->getKey(), 'ex' => $facet->getExcludes())));
     $request->addParam("f.{$field}.facet.limit", $facet->getLimit());
     $request->addParam("f.{$field}.facet.sort", $facet->getSort());
     $request->addParam("f.{$field}.facet.prefix", $facet->getPrefix());
     $request->addParam("f.{$field}.facet.offset", $facet->getOffset());
     $request->addParam("f.{$field}.facet.mincount", $facet->getMinCount());
     $request->addParam("f.{$field}.facet.missing", $facet->getMissing());
     $request->addParam("f.{$field}.facet.method", $facet->getMethod());
 }
Exemple #3
0
 /**
  * Add params for a field facet to request.
  *
  * @param Request    $request
  * @param FacetField $facet
  */
 public function addFacetField($request, $facet)
 {
     $field = $facet->getField();
     $request->addParam('facet.field', $this->renderLocalParams($field, array('key' => $facet->getKey(), 'ex' => $facet->getExcludes())));
     $request->addParam("f.{$field}.facet.limit", $facet->getLimit());
     $request->addParam("f.{$field}.facet.sort", $facet->getSort());
     $request->addParam("f.{$field}.facet.prefix", $facet->getPrefix());
     $request->addParam("f.{$field}.facet.contains", $facet->getContains());
     $request->addParam("f.{$field}.facet.contains.ignoreCase", is_null($ignoreCase = $facet->getContainsIgnoreCase()) ? null : ($ignoreCase ? 'true' : 'false'));
     $request->addParam("f.{$field}.facet.offset", $facet->getOffset());
     $request->addParam("f.{$field}.facet.mincount", $facet->getMinCount());
     $request->addParam("f.{$field}.facet.missing", $facet->getMissing());
     $request->addParam("f.{$field}.facet.method", $facet->getMethod());
 }