Reputation: 16726
I have a database of objects which have each been assigned to multiple categories. I am using sphinx search to search the products but would also like to filter the results to only objects that match an array of categories.
Upvotes: 2
Views: 1309
Reputation: 1719
You may use SetFilter exclude option to solve this.
For example you have following category IDs:1,2,3,4,5 and you need to search in 1 or 3 category.
$sphinx->SetFilter("category_id", (2,4,5), true);
code above will exclude from search categories 2,4 and 5, so in our case search will perform only in category 1 and 3.
Upvotes: 1