Monday, 15 April 2013

php - Enabling partial word matches in Sphinx? -



php - Enabling partial word matches in Sphinx? -

i'm new sphinx , trying configured correctly. want allow partial word matching searches , not want users have type in wildcard characters on own.

i'm wanting search function on amazon or google if start typing word, suggestions come up. so, example, if typed in "x", matches "xbox" should appear.

here index settings have:

min_word_len = 1 min_prefix_len = 1 prefix_fields = name charset_type = utf-8

on php side of things, i'm using sph_match_extended2 , sph_sort_relevance. left ranking mode default, whatever is. these settings seemed provide best search results when changed settings based on trial , error.

i've read similar questions on here , on other sites, answers seem reference enable_star documentation says deprecated.

so question is, how enable partial word matches in sphinx? should append * every word in users query, doing this?

$search = str_replace(' ', '* ', trim($search)) + '*';

can utilize http://sphinxsearch.com/docs/current.html#conf-expand-keywords

it actully pretty much adds stars automatically - in way in general exact matches rank higher pure 'part' matches.

php sphinx

No comments:

Post a Comment