protected function init() { parent::init(); // set a query (all prices starting from 12) $this->setQuery('price:[12 TO *]'); // set start and rows param (comparable to SQL limit) using fluent interface $this->setStart(2)->setRows(20); // set fields to fetch (this overrides the default setting 'all fields') $this->setFields(array('id', 'name', 'price')); // sort the results by price ascending $this->addSort('price', self::SORT_ASC); }
protected function init() { parent::init(); // basic params $this->setQuery('*:*'); $this->setStart(2)->setRows(20); $this->setFields(array('id', 'name', 'price')); $this->addSort('price', self::SORT_ASC); // create a facet field instance and set options $facetSet = $this->getFacetSet(); $facetSet->createFacetField('stock')->setField('inStock'); }