我在MySQL表的title字段上创建了一个sphinx索引,用于对标题进行快速全文搜索。我使用以下索引定义:
source src1
{
type = mysql
sql_host = XXX
sql_user = XXX
sql_pass = XXX
sql_db = XXX
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT ID,SONGID,TITLE \
FROM srch_info
sql_field_string = TITLE
sql_attr_uint = SONGID
sql_query_info = SELECT * FROM srch_info WHERE ID=$ID
}
index test1
{
source = src1
path = /var/data/test1
min_word_len = 3
min_infix_len = 3
charset_type = utf-8
}
索引器成功运行,并且在查询索引时返回的结果不令人满意。例如,
mysql> SELECT title FROM test1 WHERE MATCH('Mera man kehne laga') limit 100 ;
|标题|
| Mera Mann Kehne Laga |
| Mera Mann Kehne Laga Remix |
| Mera Mann Kehne Laga Reprise |
| Mera Mann Kehne Laga Tulsi |
4行(0.01秒)
如果所有单词都匹配则返回匹配,而如果我使用MySQL的全文搜索支持,那么即使其中一个单词匹配,也会返回该行。例如:
mysql> mysql> SELECT title FROM srch_rbt_metadata_info WHERE MATCH(title) against ('Mera man kehne laga') limit 100 ;
|标题|
| Mera Mann Kehne Laga |
| Mera Mann Kehne Laga Tulsi |
| Mera Mann Kehne Laga Remix |
| Mera Mann Kehne Laga Reprise |
| Mera Dil Kehne Lagaa |
| Mar Na Jao Mera Mann Kehne |
| mera dil kehne lagaa |
| Mera Dil Kehne Lagaa |
| Marna Jaongi Mera Mann Kehne |
| Tujhe Apna Mera Mann Kehne |
| Mera Man Laga |
| Dil Mera Laga |
| Mera Dil Laga |
| Mera Man Laga Hai Ram |
| Dil Mera Churane Laga |
| Mera Man Laga Tohe |
| dil mera churane laga |
| Mera Mann Laga Hai |
| Mera Mann Laga Hai |
| Man Laga Mera Yaar |
| Mera Mann Laga Hai |
| Dil Mera Churane Laga |
| Man Laga Mera Yaar |
| Mera Man Laga Tohe |
| mera man laga hai ram pyare |
| Dil Mera Khone Laga |
| Nilima Laga Dildu Mera |
| Mera Dhyan Laga Teri Or |
| Mera Mann Laga Tohey |
| Mera Dil Bekarar Hone Laga |
| Mera Jeevan Badalne Laga |
| Kaisa Laga Mera Video Kand |
我希望Sphinx能够匹配搜索中的任何单词,并返回类似于MySQL正在做的响应。我没有使用后一种方法的原因是Sphinx应该比MySQL更快
你能指点一下Sphinx中的一些配置,它允许匹配任何搜索词而不是默认值吗?
答案 0 :(得分:1)
sphinxQL> SELECT title FROM test1 WHERE MATCH(' "Mera man kehne laga"/1 ') limit 100 ;