<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [Xunsearch PHP-SDK](http://www.xunsearch.com) v1.4.8 權威指南 1. [Discuz 的論壇貼子 MySQL 表結構](#) 1. [搜索的設計與分析](#) 1. [字段設計與分析](#) 1. [配置文件結果](#) # 編寫第一個配置文件 `Xunsearch` 的配置文件是純文本的 `INI` 格式,用任何文本編輯器均可編寫,在 `Unix` 類型的系統下推薦用 `vi`,而 `Windows` 下可以用記事本或 `EditPlus` 進行編寫。我們也正在計劃不久的將來制作一個 `Web`界面的編輯工具,以便進行可視化的設計以及約束檢測。 > **Tip:** 目前我們針對新手用戶開發了一個 WEB 版本的在線配置文件編輯輔助工具,[點擊試用](http://www.xunsearch.com/tools/iniconfig)。 如果您是從頭閱讀到這兒,應該對配置文件也有了基本的了解,下面我們以傳統的 `discuz` 論壇貼子為例子,來學習編寫配置文件。 ### 1. Discuz 的論壇貼子 MySQL 表結構[?]() 由于我們只是對貼子進行搜索,所以只需要關心它的貼子表即可,表結構如下: ~~~ -- -- 表的結構 `cdb_posts` -- CREATE TABLE `cdb_posts` ( `pid` int(10) unsigned NOT NULL auto_increment, `fid` smallint(6) unsigned NOT NULL default '0', `tid` mediumint(8) unsigned NOT NULL default '0', `first` tinyint(1) NOT NULL default '0', `author` varchar(15) NOT NULL default '', `authorid` mediumint(8) unsigned NOT NULL default '0', `subject` varchar(80) NOT NULL default '', `dateline` int(10) unsigned NOT NULL default '0', `message` mediumtext NOT NULL, `useip` varchar(15) NOT NULL default '', `invisible` tinyint(1) NOT NULL default '0', `anonymous` tinyint(1) NOT NULL default '0', `usesig` tinyint(1) NOT NULL default '0', `htmlon` tinyint(1) NOT NULL default '0', `bbcodeoff` tinyint(1) NOT NULL default '0', `smileyoff` tinyint(1) NOT NULL default '0', `parseurloff` tinyint(1) NOT NULL default '0', `attachment` tinyint(1) NOT NULL default '0', `rate` smallint(6) NOT NULL default '0', `ratetimes` tinyint(3) unsigned NOT NULL default '0', `status` tinyint(1) NOT NULL default '0', PRIMARY KEY (`pid`), KEY `fid` (`fid`), KEY `authorid` (`authorid`), KEY `dateline` (`dateline`), KEY `invisible` (`invisible`), KEY `displayorder` (`tid`,`invisible`,`dateline`), KEY `first` (`tid`,`first`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ~~~ ### 2. 搜索的設計與分析[?]() 首先得搞明白我們要得到什么樣的搜索效果,進行針對性的設計和分析才能確定需要哪些字段。在這個案例中我們的需求是要對所有的論壇貼子進行標題、內容、作者全文檢索,并希望搜索結果能過濾回貼、按發表時間排序、能按版塊過濾。明確了意圖之后我們就只需要從數據表中提取必要的字段即可。 - `pid` 主鍵,必須的 - `fid` 按版塊檢索時需要用到 - `tid` 搜索結果閱讀鏈接都是按 tid 來的,必備 - `first` 表示該貼子是否為樓主,過濾回貼時用到 - `author`, `authorid` 按作者檢索用得到 - `subject` 標題 - `message` 貼子內容 - `dateline` 發表時間,要用到 其它的有些字段,比如 `invisible`, `anonymous` 表面看上去跟搜索結果也是有關系的,但實際上這些可以在索引入庫時進行處理和排除,完全沒有必要放到搜索數據中去,所以不列入。 ### 3. 字段設計與分析[?]() 得到字段后,進一步分析各個字段的用途與寫法。 - `pid` 非常明顯,它是主鍵,所以它的類型必須是 `id` - `fid` 內容為數字的版塊ID,但由于我們不需要對它進行排序或區間查找,所以用 `string` 類型即可,為了按版塊檢索,我們必須對它進行索引,而它也不需要分詞,所以分詞器用內置的 `full`。 - `tid` 內容也是數字的主題ID,我們暫不考慮按主題搜索,所以不需要索引,也沒有排序等要求,所以只要當作普通字段存儲下來即可。 - `first` 用 1/0 不同值來表示是否為樓主,考慮到回貼過濾需求,它也需要索引,整個字段轉換成一個詞即可,分詞器當然選用 `full`。 - `author` 作者名字檢索,考慮中文名支持,所以建議這個字段保留使用默認內置的 `scws` 分詞器。由于希望在默認不指明字段的情況下也能檢索作者字段,所以它的過索引方式應為 `both`。 - `authorid` 作者 ID,我們只用于搜索結果的作者鏈接,不需要索引。 - `subject` 標題類型為 `title`。 - `message` 主內容,類型為 `body`。 - `dateline` 時間戳記,由于需要排序,所以該字段不能存為 `string`,必須用 `numeric`,但不需要進行任何索引。 ### 4. 配置文件結果[?]() 自此字段分析與設計已然明了,下面給出完整的配置文件內容,實際使用時可以將文件保存至`$prefix/sdk/php/app/discuz.ini`。 ~~~ project.name = discuz project.default_charset = GBK ;服務端用默認值 ;server.index = 8383 ;server.search = 8384 [pid] type = id [fid] index = self tokenizer = full [tid] [first] index = self tokenizer = full [author] index = both [authorid] [subject] type = title [message] type = body [dateline] type = numeric ~~~ $Id$ [? 自定義分詞器](#) [索引概述 ?](#) Copyright ? 2008-2011 by [杭州云圣網絡科技有限公司](http://www.xunsearch.com) All Rights Reserved. ![](https://box.kancloud.cn/2015-09-10_55f11d02cc334.gif) ![](https://box.kancloud.cn/2015-09-10_55f11d02d2f0f.gif) ![](https://box.kancloud.cn/2015-09-10_55f11d02d9928.gif)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看