I'm looking sphinx and discovered a way to set up filters by one or more criteria. I'll get a database o开发者_如何学编程f recipes.
In the pastry, I have a table "records". I have cards for every type field is an integer. I also have a field "kind" and finally a last field called "ingredients".
I'm looking for several things. For the following example I have this database, which works but is not complete: http://pastebin.com/80LbtnZW and this is my sphinx.conf: http://pastebin.com/Nmpci1aC I would first like to show my field type only in descending order of id, what should I add? I would now add a filter and take only the chocolates that are kind = 2. And finally the same thing, with an additional filter ingredients = 'milk'
What should I add as a filter to sort by id, and thereafter, to establish one or more filters.
Sort by ID...
$sphinx->SetSortMode(SPH_SORT_EXTENDED, '@id DESC');
Add filter...
$sphinx->SetFilter('kind', array(2));
You can add as many filters as you like, make sure you have delcared the fields you are filtering as attributes.
精彩评论