I have setup sphinx and can perform searches using the php api. But I have two questions.
-
In this test database I have a number of products which each have a category id. How would I go about creating a filtering function so that a user after a search can retrieve results ONLY from a specific category. Thats is, first i search for car and get 10 matches, then I choose the category Ford and only get 3 matches, ie the cars with category Ford.
-
I’m a little confused to wheter sphinx searches my index or search the db direcly. I thought it searched the index, but then I changed a text in the db and made a search wihout reindexing, and the changes I made to the text showed up in the result.
All help much appreciated, as allways!
To create a filter, you must add the attribute to your data source (don’t forget to select it in your SQL query
SELECT category_id, ...):Then you’ll be able to add a filter from your PHP code:
For your second question, you need to run the indexer to update the data.