views:

56

answers:

1

Hi

Where I have a search which has a category (foreign key) and optional text, should I use thinking sphinx to "search" where a search string has not been submitted, solely the category?

+1  A: 

It really depends on your use case. Let's say for example you have blog posts, and they have categories a, b, and c.

If you want yoursite.com/a/ to list all posts in category a in order from newest to oldest, then it's probably not the greatest idea to use sphinx/search for that. It will be a simple database query, possibly with pagination.

However, let's say you want that page to list all posts with that category, or that might relate to that category according to the text, and also maybe posts that have tags related to that category. In this case, it is probably best to use a search engine, like sphinx, to power this page. The search engine will be much faster if the equivalent database query is very expensive.

Apreche
Hi and thanks for your reply. The first scenario you describe is the case where a user navigates to a category. They then enter a search string and/or select many to many tags. I just really wondered about moving the category among the tags and having a consistent search performed by sphinx, whether text or not. I potentially need items to have many categories and this would have allowed more flexibility. Comparatively, is sphinx slower than mysql for non-text search? Thanks again.
mark
Full text search is largely where sphinx and other search engines (Lucene, Xapian, Solr) out perform MySQL.
Greg K