Reputation: 11
I have created a sphinx index on title field of a MySQL table for doing fast full-text search on the title. I'm using the following index definition:
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
}
The indexer runs successfully and on querying the index the results which are returned are not satisfactory. For example,
mysql> SELECT title FROM test1 WHERE MATCH('Mera man kehne laga') limit 100 ;
| title |
| Mera Mann Kehne Laga |
| Mera Mann Kehne Laga Remix |
| Mera Mann Kehne Laga Reprise |
| Mera Mann Kehne Laga Tulsi |
4 rows in set (0.01 sec)
It returns a match if all the words are matched whereas if I use the Full Text Search support of MySQL then even if one of the words is matched, the row is returned. Example:
mysql> mysql> SELECT title FROM srch_rbt_metadata_info WHERE MATCH(title) against ('Mera man kehne laga') limit 100 ;
| title |
| 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 |
What I would like Sphinx to do is to match any of the words in the search and return a response similar to what MySQL is doing. The reason I'm not using the latter approach is that Sphinx is supposed to be faster than MySQL
Could you point me to some configuration in Sphinx which allows matching any of the search words and not defaults to all ?
Upvotes: 1
Views: 1059
Reputation: 21081
sphinxQL> SELECT title FROM test1 WHERE MATCH(' "Mera man kehne laga"/1 ') limit 100 ;
http://sphinxsearch.com/docs/current.html#extended-syntax
Upvotes: 1