讓Dedecms自帶搜索實(shí)現(xiàn)全文檢索(支持標(biāo)題與內(nèi)容)

字號(hào):


    登陸Dedecms 后臺(tái)—核心—頻道模型—內(nèi)容模型管理—普通文章—點(diǎn)擊后面那個(gè)放大鏡標(biāo)志(最重要一步)—附件表可供自定義搜索的字段,這里的字段是程序依據(jù)字段類型自動(dòng) 選擇生成的,將“文章內(nèi)容”前面那個(gè)打勾,此時(shí)將修改掉搜索字段,但是還沒有成功,還需要修改模板相應(yīng)的代碼。
    將模板文件head.htm 中的以下代碼:
    代碼如下:
    <form action="{dede:field name='phpurl'/}/search.php" name="formsearch">
    <div>
    <h4>搜索</h4>
    <input type="hidden" name="kwtype" value="0" />
    <input name="keyword" type="text" id="search-keyword" />
    <select name="searchtype" id="search-option">
    <option value="titlekeyword" selected='1'>智能模糊搜索</option>
    <option value="title">僅搜索標(biāo)題</option>
    </select>
    <button type="submit">搜索</button>
    </div>
    </form>
    修改為:
    代碼如下:
    <form action="/plus/advancedsearch.php" method="post">
    <div>
    <h4>搜索</h4>
    <input type="hidden" name="mid" value="1" />
    <input type="hidden" name="dopost" value="search" />
    關(guān)鍵詞:<input type="text" name="q" /> <input type="submit" name="submit" value="開始全文搜索" /></div>
    </form>
    此時(shí)更新網(wǎng)站,將會(huì)發(fā)現(xiàn)搜索數(shù)據(jù)已經(jīng)有了質(zhì)的飛躍!
    但同時(shí)帶來的問題是,會(huì)降低效率。如果訪問量過大不建議這樣操作。