timewasted / Search-SphinxsearchBundle

Sphinx search bundle for Symfony 2.
http://sphinxsearch.com/
BSD 2-Clause "Simplified" License
40 stars 33 forks source link

Using search method #7

Open catalinux opened 12 years ago

catalinux commented 12 years ago

On your readme you still have the old usage of search method

$indexesToSearch = array(
  'Items' => array(
    'result_offset' => 0,
    'result_limit' => 25,
    'field_weights' => array(
      'Name' => 2,
      'SKU' => 3,
    ),
  ),
  'Categories' => array(
    'result_offset' => 0,
    'result_limit' => 10,
  ),
);
$sphinxSearch = $this->get('search.sphinxsearch.search');
$sphinxSearch->setMatchMode(SPH_MATCH_EXTENDED2);
$sphinxSearch->setFilter('disabled', array(1), true);
$searchResults = $sphinxSearch->search('search query', $indexesToSearch);

Now id does not work any more. It works with

$indexesToSearch = array(
  'Items',
  'Categories',
);
$queryOptions = array(
  'result_offset' => 0,
  'result_limit' => 25,
);
$sphinxSearch = $this->get('search.sphinxsearch.search');
$searchResults = $sphinxSearch->search('search query', $indexesToSearch, $queryOptions);

from https://github.com/timewasted/Search-SphinxsearchBundle/pull/5