Sphinx自动完成搜索

时间:2014-10-10 05:10:25

标签: sphinx

我尝试使用sphinx和ajax进行Google风格的自动完成搜索。 假设用户正在寻找iPhone。目标是输入像" ip"," iph"," ipho"必须给我结果,但事实并非如此,而#34; iphon"或" iphone"做。 那么,我在这里做错了什么?

index product
{

        source = product


        path = /var/lib/sphinx/product



        docinfo = extern


        mlock = 0


        morphology = stem_enru


        min_word_len = 2


        charset_type = utf-8


        charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F

        min_prefix_len = 2

        max_substring_len = 6

        enable_star = 1


}

和查询

    $sphinx = new SphinxClient();`

    $sphinx -> SetLimits (0,1500,2500);

    $sphinx->SetServer('localhost', 9312);


    $sphinx->SetMatchMode(SPH_MATCH_EXTENDED);


    $sphinx->SetSortMode(SPH_SORT_RELEVANCE);


    $sphinx->SetFieldWeights(array ('name' => 30, 'brand' => 20, 'parent_name' => 10, 'description' => 5));


    $result = $sphinx->Query($string, '*');

0 个答案:

没有答案