我需要简单解释一下为什么我的查询无法带来我需要的结果。
Sphinx 2.0.8-id64-release (r3831) 这是我在 sphinx.conf 中的内容:
SELECT
trackid,
title,
artistname,
SUBSTRING(REPLACE(TRIM(`artist_name`), 'the ', ''),1,3) AS artistname_init
....
sql_field_string = title
sql_field_string = artistname
sql_field_string = artistname_init
其他设置:
docinfo = extern
charset_type = utf-8
min_prefix_len = 1
enable_star = 1
expand_keywords= 0
charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z
查询有效。我索引我的数据没有问题。但是我没有让狮身人面像带来任何明智的结果。我正在使用 SphinxQL 进行查询。
例子:
select
artistname, artistname_init from myindex
WHERE MATCH('@artistname_init ^t*')
GROUP BY artistname ORDER BY artistname_init ASC limit 0,10;
没有带来与查询相关的任何内容。我已经尝试了我能想到的一切:
MATCH('@artistname_init ^t*')
MATCH('@artistname_init[1] t')
MATCH('@artistname_init ^t$')
谁能指出我的错误在哪里,也许可以给我一些适合我的情况的查询?我的目标是获得遵循此排序顺序的结果:
B (Single letter)
B-T (Single letter + non-alphabet sign after)
B as Blue (Single letter + space after)
Baccara (First letter of single word)
Bad Religion (First letter of several words)
The B (not counting "The ")
The B.Y.Z (Single letter + non-alphabet sign after not counting "The ")
The B 2 B (Single letter + space after not counting "The ")
The Boyzz (First letter of single word not counting "The ")
The Blue Boy (First letter of several words not counting "The ")
或者接近它。