如何在Sphinx中允许特殊字符(#,@,!,&,(,),%)作为搜索关键字

时间:2013-04-01 13:11:19

标签: sphinx

我对在Sphinx中允许使用特殊字符(#,@,!,&,(,),%)作为搜索关键字感到震惊。

请建议我..

以下是配置文件

/ *开始* /

source dbserver
{
    type                    =   mysql
    sql_host                =   localhost
    sql_user                =   root
    sql_pass                =   
    sql_db                  =   mydb
    #sql_sock               =   /var/run/mysqld/mysqld.sock
    sql_port                =   3306 
}


searchd
{
    listen                  =   localhost:3312
    # port                  =   9313
    log                     =                       /* some searchd.log path */
    query_log               =                   /* some query.log path */
    pid_file                =                   /* some searchd.pid path */
    max_matches             =   10000
    seamless_rotate         =   0
}


source  adsearch : mydbserver
{
    sql_query_post          = REPLACE INTO sph_tracker SELECT 1,'ad',CURRENT_TIMESTAMP;

    sql_ranged_throttle     = 1
    sql_attr_uint           = networkid
    sql_attr_uint           = folderid
    sql_attr_uint           = createdby
    sql_attr_uint           = status
    sql_attr_timestamp      = createdon
}

index index_adsearch
{
    source                  = adsearch
    path                    =           /* some path */
    morphology              = stem_en
    min_word_len            = 0
    #min_prefix_len         = 5
    min_infix_len           = 2
    enable_star             = 1
    preopen                 = 1
}

source delta_adsearch : adsearch
{
    sql_query   = DELETE FROM ad where status='Deleted' AND deleteflag='Y'                              
}

index delta_index_adsearch : index_adsearch
{
    source                  = delta_adsearch
    path                    =               /* some path */
}

source  tmplsearch : mydbserver
{
     sql_query_post         = REPLACE INTO sph_tracker SELECT 2,'template',CURRENT_TIMESTAMP;


    sql_ranged_throttle     = 1
    sql_attr_uint           = networkid
    sql_attr_uint           = industryid
    sql_attr_uint           = status
    sql_attr_timestamp      = createdon
    sql_attr_timestamp      = startdate
    sql_attr_timestamp      = enddate
    sql_attr_uint           = active
    sql_attr_uint   = primarysize
}

index index_tmplsearch
{
    source                  = tmplsearch
    path                    =               /* some path */
    morphology              = stem_en
    min_word_len            = 0
    #min_prefix_len         = 5
    min_infix_len           = 2
    enable_star             = 1
    preopen                 = 1
}

source delta_tmplsearch : tmplsearch
{
    sql_query   = DELETE FROM adtemplate where status='Deleted' AND deleteflag='Y'                              
}

index delta_index_tmplsearch : index_tmplsearch
{
    source                  = delta_tmplsearch
    path                    =               /* some path */
}


source  media_assets_search : mydbserver
{   
    #sql_query_post         = REPLACE INTO sph_tracker SELECT 3,'media',CURRENT_TIMESTAMP;

    sql_ranged_throttle     = 1
    sql_attr_uint           = networkid
    sql_attr_uint           = mediatype
    sql_attr_uint           = mediacat
    sql_attr_uint           = uploadedby
    sql_attr_uint           = active    
    sql_attr_uint           = industryid        
    sql_attr_timestamp      = uploaddate
    sql_attr_uint           = diskstore
}

index index_media_assets_search
{
    source                  = media_assets_search
    path                    =               /* some path */
    morphology              = stem_en
    min_word_len            = 0
    #min_prefix_len         = 5
    min_infix_len           = 2
    enable_star             = 1
    preopen                 = 1
}

source delta_media_assets_search : media_assets_search
{

}

index delta_index_media_assets_search : index_media_assets_search
{
    source                  = delta_media_assets_search
    path                    =                   /* some path */
}

/ *结束* /

请看看这个并建议我..

谢谢,

纳古..

1 个答案:

答案 0 :(得分:0)

您需要将它们添加到charset_table配置。

您可能还希望确保转义查询以避免被误解为搜索语法。

虽然也读了blend_chars