思考 sphinx/mysql 用于非文本搜索
如果我的搜索包含类别(外键)和可选文本,我是否应该使用思考狮身人面像来“搜索”尚未提交搜索字符串(仅提交类别)的地方?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上取决于您的用例。假设您有博客文章,并且它们有类别 a、b 和 c。
如果您希望 yoursite.com/a/ 按从最新到最旧的顺序列出类别 a 中的所有帖子,那么使用 sphinx/search 可能不是最好的主意。这将是一个简单的数据库查询,可能带有分页。
但是,假设您希望该页面列出具有该类别的所有帖子,或者根据文本可能与该类别相关的帖子,也可能列出具有与该类别相关的标签的帖子。在这种情况下,最好使用搜索引擎(例如 sphinx)来支持此页面。如果等效的数据库查询非常昂贵,则搜索引擎会更快。
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.