Search code examples
phpmysqlwildcardsphinx

Only exact with wildcard matching and proximity using Sphinx Search Engine (API-PHP)


I have this huge problem properly configuring Sphinx, I have an index of name, tags and cat_tags. I would like return extended matches, e.g.

if I type "eng" I should receive all records matching "eng", so: engine, english, boateng (for any indexed field) would be inlucded within the query result. How should I configure my index and my PHP-API in order to get desired result? Also how should the exact query look, taking $phrase being a phrase we are looking for (one or more words, we need all perfect matches along with possible matches - just like search hinting would give us).


Solution

  • By default sphinx indexes whole words - as per charset_table.

    To match part words look at min_infix_len http://sphinxsearch.com/docs/current.html#conf-min-infix-len

    enable it along with expand keywords http://sphinxsearch.com/docs/current.html#conf-expand-keywords