The data what i have is
kiran@test.com – first record
kiran1@test.com – second record
I need to search using the email address. I have forums and users indexed in my web app.
First scenario
I kept the ‘@’ symbol in the charset table which is working fine problem is for example if the search keyword as ‘kiran@test.com’ it is giving me the exact result but if i user only ‘test’ no results found.
Second scenario
If i won’t keep ‘@’ symbol in the charset table. If the i use ‘kiran@test.com’ i am getting both the results and for ‘test’ also i am getting both the results
Expected Scenario
If i use the entire email ‘kiran@test.com’ – I need to get only first record
If i use only ‘test’ – I need to get both the records
In plain mysql something like “select users where email like ‘%search-key%'”
I use the following code for searching
ThinkingSphinx.search params[:search_key],:star => Regexp.new(‘\w+@*\w+’, nil, ‘u’) (I don’t want to treat ‘@’ as the separator)
Please suggest me any options i can pass to achieve the expected result.
Thanks
Kiran
Take a look at blended char support
http://sphinxsearch.com/docs/current.html#conf-blend-chars
Or if you really what [ email like ‘%search-key%'” ] style support maybe min_infix_len. (leaving . and @ in charset table)