Beispiel #1
0
 public function testBasicFacet()
 {
     $filter = new Facet();
     $filter->field('category');
     $this->assertEquals('facet=true&facet.field=category', $filter->render());
     $filter = new Facet();
     $filter->field('category')->minCount(1)->limit(5);
     $this->assertEquals('facet=true&facet.field=category&facet.mincount=1&facet.limit=5', $filter->render());
     $filter = new Facet();
     $filter->field('category')->field('test');
     $this->assertEquals('facet=true&facet.field=category&facet.field=test', $filter->render());
     $filter = new Facet();
     $filter->field('category')->field('test')->prefix('A');
     $this->assertEquals('facet=true&facet.field=category&facet.field=test&facet.prefix=A', $filter->render());
 }
Beispiel #2
0
 public function testWithFacets()
 {
     $facet = new Facet();
     $facet->field('category')->limit(1)->minCount(1);
     $select = new Select();
     $select->search('opendi', 'name')->facet($facet);
     $this->assertEquals('q=name%3Aopendi&facet=true&facet.field=category&facet.limit=1&facet.mincount=1', $select->render());
 }