symfony - Facets doesnt work on FOSElasticaBundle -
if(count($pricerange)){ $facets = new \elastica\facet\range('price'); $facets->setfield('price'); foreach ($min $key => $value) { $facets->addrange(intval($min[$key])*100, intval($max[$key])*100); } $facets->setglobal(false); $query->addfacet($facets); }
this doesn't work me, trying search on 2 ways.
like this:
$client = $this->container->get('fos_elastica.client') $searcher = new \elastica\search($client) $esresultset = $searcher->search($query , 500) $arrayofresults = $esresultset->getresults() $facets = $esresultset->getfacets()
or this
$resultset = $finder->find($query, 500)
neither of works. why facet range doesn't work?
here more code:
$boolquery = new \elastica\query\bool(); $fieldtext = new \elastica\query\text(); $fieldtext->setfieldquery('name', $keyword); $fieldtext->setfieldparam('name', 'analyzer', 'my_analyzer'); $boolquery->addmust($fieldtext); $fieldtext = new \elastica\query\text(); $fieldtext->setfieldquery('description', $keyword); $fieldtext->setfieldparam('description', 'analyzer', 'my_analyzer'); $boolquery->addshould($fieldtext); $fieldterms = new \elastica\query\terms(); $fieldterms->setterms('country_id', $countryarray); $boolquery->addmust($fieldterms); $fieldterms = new \elastica\query\terms(); $fieldterms->setterms('taxon_ids', $themearray); $boolquery->addmust($fieldterms); $query->setsort(array("price" => array("order" => "asc")));
Comments
Post a Comment