在狮身人面像查询中两次使用具有不同user_weights的字段

时间:2019-05-15 10:29:01

标签: sphinx

我有一个能正常工作的索引,一切都很好,但是有些小事情困扰着我。 我要用一个不同的字符串在同一字段中搜索两次,因此我想为其分配不同的user_weights。

我通过更改索引,选择两次具有不同名称的字段来完成此工作。 但这对我来说有点不对劲。

是否可以使用相同的字段两次使用不同的用户权重?

我了解了关键字增强的知识,但是由于我的查询大多比单个关键字复杂得多,因此有点混乱。

示例查询(我整理了一下,生成了搜索词列表):

SELECT titel, age_firstdate, age_priodatum, uniqueserial(partner) as sortid,
        weight() as w, if (w > 200000, IF(w > 500000, 2, 1) ,0)  as intitel, IF (w>5000, 1, 0) as ingroup,
        sort_w + sort_intitel as score, 0 as geodist
    FROM anzeigen
    WHERE MATCH('( 
    (@titel_dup wachfrau) |
    (@titel_mf (wachmann|wachfrau|wachleute)) |
    (@titel (("Fachkraft Schutz Sicherheit"|[...]|"Wachleute"))) |
    (@titel_low (("Security Detektiv"|[...]|"450 Security"))))
') AND  geodist <= 30
    ORDER BY geodist ASC, intitel DESC, ingroup DESC, score DESC
    LIMIT 10000
    OPTION  max_matches=100000, field_weights = (titel_dup=500001, titel_mf=200001, titel=5001, titel_low = 100, beschreibung=5),
ranker=expr('sum(word_count*user_weight*lcs)')

索引定义(也要清理):

sql_query = SELECT SQL_NO_CACHE \
        s.id, s.titel, s.titel as titel_dup, s.titel as titel_mf, s.titel as titel_low,[...] \
 FROM _sphinxSource s

sql_field_string         = titel
sql_field_string         = titel_dup
sql_field_string         = titel_mf
sql_field_string         = titel_low

0 个答案:

没有答案
相关问题