Beispiel #1
0
 /**
  * Add request settings for FacetSet
  *
  * @param Solarium_Query_Select_Component_FacetSet $component
  * @param Solarium_Client_Request $request
  * @return Solarium_Client_Request
  */
 public function buildComponent($component, $request)
 {
     $facets = $component->getFacets();
     if (count($facets) !== 0) {
         // enable faceting
         $request->addParam('facet', 'true');
         // global facet params
         $request->addParam('facet.sort', $component->getSort());
         $request->addParam('facet.prefix', $component->getPrefix());
         $request->addParam('facet.missing', $component->getMissing());
         $request->addParam('facet.mincount', $component->getMinCount());
         $request->addParam('facet.limit', $component->getLimit());
         foreach ($facets as $facet) {
             switch ($facet->getType()) {
                 case Solarium_Query_Select_Component_FacetSet::FACET_FIELD:
                     $this->addFacetField($request, $facet);
                     break;
                 case Solarium_Query_Select_Component_FacetSet::FACET_QUERY:
                     $this->addFacetQuery($request, $facet);
                     break;
                 case Solarium_Query_Select_Component_FacetSet::FACET_MULTIQUERY:
                     $this->addFacetMultiQuery($request, $facet);
                     break;
                 case Solarium_Query_Select_Component_FacetSet::FACET_RANGE:
                     $this->addFacetRange($request, $facet);
                     break;
                 default:
                     throw new Solarium_Exception('Unknown facet type');
             }
         }
     }
     return $request;
 }
 public function testSetAndGetPrefix()
 {
     $this->_facetSet->setPrefix('xyz');
     $this->assertEquals('xyz', $this->_facetSet->getPrefix());
 }