Esempio n. 1
0
 /**
  * Submit requests for more spelling suggestions.
  *
  * @param Spellcheck $spellcheck Aggregating spellcheck object
  * @param string     $query      Spellcheck query
  *
  * @return void
  */
 protected function aggregateSpellcheck(Spellcheck $spellcheck, $query)
 {
     while (next($this->dictionaries) !== false) {
         $params = new ParamBag();
         $params->set('spellcheck', 'true');
         $params->set('spellcheck.dictionary', current($this->dictionaries));
         $queryObj = new Query($query, 'AllFields');
         $collection = $this->backend->search($queryObj, 0, 0, $params);
         $spellcheck->mergeWith($collection->getSpellcheck());
     }
 }
 /**
  * Submit requests for more spelling suggestions.
  *
  * @param Spellcheck $spellcheck Aggregating spellcheck object
  * @param string     $query      Spellcheck query
  *
  * @return void
  */
 protected function aggregateSpellcheck(Spellcheck $spellcheck, $query)
 {
     while (next($this->dictionaries) !== false) {
         $params = new ParamBag();
         $params->set('spellcheck', 'true');
         $params->set('spellcheck.dictionary', current($this->dictionaries));
         $queryObj = new Query($query, 'AllFields');
         try {
             $collection = $this->backend->search($queryObj, 0, 0, $params);
             $spellcheck->mergeWith($collection->getSpellcheck());
         } catch (\Exception $ex) {
             if ($this->logger) {
                 $this->logger->err("Exception thrown when aggregating spellcheck, ignoring.", array('exception' => $ex));
             }
         }
     }
 }