[英]Making a simple search engine php mysql
我有一個名為id|tag_title|post_id
類的tags
的下表,以及具有id|title
的表posts
我能夠使用fulltext
功能進行搜索,但僅限於在posts
表中搜索title
。 我想要的是在tags
和posts
表中搜索並獲得最佳結果。 我該怎么做... !!!
我的查詢:
Select title from posts where Match(title) Against('$search' in boolean mode)
你可以試試:
SELECT title FROM posts WHERE Match(title) Against('$search' IN boolean mode)
UNION
SELECT title FROM posts INNER JOIN tags ON posts.id = tags.post_id WHERE Match(tag_title) Against('$search' IN boolean mode)
如果您需要更高級的功能,請查看Apache Solr或Apache Lucence。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.