I am pretty new to sphinx, so I have a question about it.
Let’s say I have a table called tv_releases
My sphinx.conf contains (small portion) :
source tv_releases
{
type = mysql
sql_host = localhost
sql_user = ---------
sql_pass = ---------
sql_db = --------
sql_port = 3306
sql_query_pre = SET NAMES utf8
#ingore for example ( delta updates ).
sql_query_pre = REPLACE INTO title_counter SELECT 3, MAX(id) FROM tv_releases
sql_query = SELECT id,rel ,tv_id,total_subs FROM tv_releases\
#ignore for example ( delta updates).
WHERE id<=( SELECT max_doc_id FROM title_counter WHERE counter_id=3 )
sql_attr_uint = total_subs
sql_attr_uint = tv_id
}
Indexing is fine , querying also.
Now sphinxapi ( php ) (portion) :
$sp = new SphinxClient();
---...
$sp->SetMatchMode(SPH_MATCH_ALL);
$sp->SetArrayResult(true);
$sp->SetLimits ( 0, 100);
$sp->SetSortMode ( SPH_SORT_EXTENDED, "@relevance DESC, ....more options" );
$results = $sp->Query('SEARCHTERM', 'tv_releases');
Now My question :
Let’s say I have the following releases ( called rel in table ).
rel 1 : Name s01e02 Format-extradata
rel 2 : Name s01e03 Format-extradata
rel 3 : Name s02e05 Format-extradata
rel 4 : Name s02e06 Format-extradata
rel 5 : Name s03e06 Format-extradata
When my SEARCHTERM is “Name S01”
I want that the matching releases ( rel) ( ordered by Relevance )
will start with all the releases containing Name s01e**
The problem is , it will not do this.
A simple Like ‘Name s01%’ in sql will do that , but the whole point of sphinx was the speed.
Someone has a solution on how to accomplish the needed (search) results in sphinx ?
Cheers
min_prefix_len (http://sphinxsearch.com/docs/current.html#conf-min-prefix-len) can help you.
Best wishes,
Sergey