mysql站內搜尋 Sphinx站內搜尋

2021-10-18 11:48:38 字數 1950 閱讀 6401

一、sphinx流程

mysql資料  -》 sphinx -》 索引資料

二、sphinx概述

三、sphinx使用地方

1、**中的搜尋(站內搜尋)

2、系統後台中的搜尋

四、為什麼要使用sphinx

當資料超過100w時,我們需要使用第三方工具,sphinx。

1、做搜尋時當資料量大單純的mysql搜尋比較慢(如果進行了分表會更慢)

如200w資料,查詢記錄中帶某個字的資料:

mysql> select * from article where title like '%孩子';

2、搜尋時中文分詞

3、sphinx快

高速的建立索引(在當代cpu中,峰值效能高達10m/s)

高效能的搜尋(在2-4g的文字資料上,平均每次檢索時間小於0.1s)

可處理海量資料

五、獲取sphinx

使用命令搜尋:

root@iz94j7:/# whereis sphinxsearch

sphinxsearch: /etc/sphinxsearch                  // 用來存放sphinx當中的一些配置檔案

安裝好後,還會有2個工具,存放在/usr/bin/下邊

root@iz94j7:/# usr/bin$ indexer  建立索引

root@iz94j7:/#usr/bin$ searched 後端的程序

六、sphinx配置

1、嘗試開啟sphinx服務

root@iz94j7:/usr/share#sudo service sphinxsearch  start

starting sphinxsearch:

// 提示需要先進行配置

七、indexer

通過indexer工具產生索引資料

八、searched

該工具預設安裝在:root@112: cd /usr/bin 目錄下

ASP站內搜尋

處理程式 case 品牌 str select from car where car pinpai like ss order by car id desc set rs db.execute str 編號汽車名稱 型號樣式 廠家汽車品牌 提交日期 do while not rs.eof rs ca...

Hexo 新增站內搜尋

針對無資料庫的靜態部落格搜尋方案一般有兩種 第三方搜尋服務 序列化站點內容作為資料來源,然後自己寫查詢方法。另外,hexo 中有使用者基礎的 swiftype 和 algolia使用也比較多。網上關於algolia 在next主題使用教程較多,這裡不多說。本文只介紹swiftype.swiftype...

案例 Ajax站內搜尋

頁面及前端處理 web層 3.使用json的轉換工具將物件或集合轉成json格式的字串 service層 根據關鍵字查詢商品 public listfindproductbyword string word throws sqlexception dao層 根據關鍵字查詢商品 public list...