小暖蓝(楼主) 1

请问怎样才能全站搜索,而不是只搜索标题

这个程序运行很流畅,但是遇到一个问题,不能全站搜索
我的站更多宝贵的东西其实是在内容部分,而不是在标题
请问官方人员或者各位技术大神,能不能在下一个版本中提供这个功能,或者加入一个选项让我们选择

发布于 2018-05-15 16:38 0 回复 举报
iCMSdev 2

全文搜索推荐配置下sphinx

发布于 2018-05-18 18:18 0 回复 举报
小暖蓝(楼主) 3

其实我找到一个捷径,在模板header.htm文件里,把<!--{$search.title}-->,修改成<!--{$search.article}-->
老大,快给我加分吧

发布于 2018-05-21 15:28 0 回复 举报
小暖蓝(楼主) 4

问题来了,如果要同时搜索标题和内容,该怎样改代码,谢谢

发布于 2018-05-21 15:29 0 回复 举报
iCMSdev 5

刚好在配官网的全文搜索
全文搜索sphinx配置
sphinx 具体怎么用 请自行百度

source icmsdev_article
{
    type        = mysql
    sql_host    = localhost
    sql_user    = mysql用户
    sql_pass    = 密码
    sql_db      = mysql用户
    sql_port    = 3306  # optional, default is 3306
    sql_query_pre   =  SET NAMES utf8
    sql_query_pre   = REPLACE INTO icms_sph_counter SELECT 1, MAX(id) FROM icms_article

    sql_query = \
        SELECT a.id, a.cid,a.userid, a.comments,ad.body,a.pubdate,a.hits_today, a.hits_yday, a.hits_week, a.hits_month,a.hits, a.haspic, a.title, a.keywords, a.tags, a.status \
        FROM icms_article a,icms_article_data ad,icms_category c \
        WHERE a.cid=c.cid AND a.id=ad.aid AND a.status ='1' AND a.id<=( SELECT max_doc_id FROM icms_sph_counter WHERE counter_id=1 )

    sql_attr_uint       = cid
    sql_attr_uint       = userid
    sql_attr_uint       = comments
    sql_attr_uint       = hits
    sql_attr_uint       = hits_week
    sql_attr_uint       = hits_month
    sql_attr_uint       = status
    sql_attr_timestamp  = pubdate
    sql_attr_bool       = haspic

    sql_ranged_throttle = 0

}
source icmsdev_article_delta : icmsdev_article
{
    sql_query_pre   =  SET NAMES utf8
    sql_query = \
        SELECT a.id, a.cid,a.userid, a.comments,ad.body,a.pubdate,a.hits_today, a.hits_yday, a.hits_week, a.hits_month,a.hits, a.haspic, a.title, a.keywords, a.tags, a.status \
        FROM icms_article a,icms_article_data ad,icms_category c \
        WHERE a.cid=c.cid AND a.id=ad.aid AND a.status ='1' AND a.id>( SELECT max_doc_id FROM icms_sph_counter WHERE counter_id=1 )

}
index icmsdev_article
{
    source         = icmsdev_article
    path           = /var/db/sphinxsearch/data/icmsdev_article
    docinfo        = extern
    mlock          = 0
    morphology     = none
    min_word_len   = 1
    #charset_type  = utf-8
    min_prefix_len = 0
    html_strip     = 1
    charset_table  = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
    ngram_len      = 1
    ngram_chars    = U+3000..U+2FA1F
}
index icmsdev_article_delta : icmsdev_article
{
    source  = icmsdev_article_delta
    path    = /var/db/sphinxsearch/data/icmsdev_article_delta
}
发布于 2018-05-23 09:59 0 回复 举报
验证码 换一张
取 消