久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

PHP MySQL 按相關性搜索和排序

PHP MySQL Search And Order By Relevancy(PHP MySQL 按相關性搜索和排序)
本文介紹了PHP MySQL 按相關性搜索和排序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我知道如何進行常規的 php mysql 搜索并顯示結果.但是,由于我要完成的工作的性質,我需要能夠按相關性進行排序.讓我更好地解釋一下:

I know how to do a regular php mysql search and display the results. However, because of the nature of what I'm trying to accomplish I need to be able to sort by relevancy. Let me explain this better:

普通查詢apple iphone applications"將使用 %apple iphone application% 搜索數據庫,但如果沒有以該確切順序顯示該短語的記錄,則搜索將不會產生任何結果.

Normal Query "apple iphone applications" will search the database using %apple iphone application%, but if there aren't records which display that phrase in that exact order the search will produce nothing.

我基本上需要做的是分別搜索 'apple'、'iphone' 和 'applications',然后將結果合并為一個,然后我需要根據找到的單詞實例的數量來對相關性進行評分在記錄中.例如,如果我做了我想做的事情并且它返回了以下內容:

What I basically need to do is search for 'apple', 'iphone' and 'applications' all separately and then merge the results into one, and then I need to grade the relevancy by how many instances of the word are found in the records. For example if I did what I wanted to do and it returned them following:

Iphone Applications From Apple
Apple Make The Best Apple Iphone Applications
Iphone Applications

他們的排名如下:

Apple Make The Best Apple Iphone Applications
Iphone Applications From Apple
Iphone Applications

因為找到了多少個搜索詞實例.請參閱突出顯示:

Because of how many instances of the search terms are found. See highlighted:

[Apple] Make The Best [Apple] [Iphone] [Applications]
[Iphone] [Applications] From [Apple]
[Iphone] [Applications]

我希望我已經解釋得足夠好,如果有人能給我任何指點,我將不勝感激.

I hope I have explained this well enough and I would be extremely grateful if anyone could give me any pointers.

推薦答案

查看MySQL FULLTEXT 搜索功能,這些應該會自動按相關性返回結果,并讓您更好地控制您的搜索

take a look at the MySQL FULLTEXT search functions, These should automatically return results by relevancy, and give you much more control over your searches

使用全文索引的唯一潛在問題是 InnoDB 表不支持它們.

The only potential issue with using fulltext indexes is that they aren't supported by InnoDB tables.

這篇關于PHP MySQL 按相關性搜索和排序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 日韩有码一区 | 密乳av| 中文字幕啪啪 | 国产免费福利小视频 | www.国产视频 | 偷偷操视频 | 亚洲精品不卡 | 国产在线视频三区 | 在线播放中文字幕 | 黄色av网站在线观看 | 狠狠干天天干 | 亚洲成av人片在线观看 | 国产在视频一区二区三区吞精 | 国产一二三区在线 | 91xxx在线观看 | 中文字幕亚洲欧美 | 波多野吉衣久久 | 日日草夜夜草 | 精品免费观看 | 亚洲免费影院 | 国产精品国产三级国产aⅴ无密码 | 在线视频亚洲 | 国产日韩欧美激情 | 特黄小视频 | 成人一区二区三区在线观看 | 久久综合久久自在自线精品自 | 蜜臀久久99精品久久久久久宅男 | 免费a网 | 国产精品一区一区三区 | 一级黄色录像片子 | 国产高清视频在线 | 亚洲aⅴ精品 | 毛片网在线观看 | 精品乱人伦一区二区三区 | 欧美日韩一 | 欧美一区二区三区四区五区无卡码 | 成人在线精品视频 | 在线播放国产一区二区三区 | 日本久久久一区二区三区 | 美女爽到呻吟久久久久 | 日本精品一区二区 |