Dexa
Dexa

Reputation: 1651

Sphinx full text search not working as expected

I'm having weird issues with sphinx that should do full text search on a single column in a table. It returns results for some values but for some it doesn't return anything.

As far as I could tell, I have word "Belgrade" in Postgres (which is source), and querying sphinx for "Belg" will give me no results. But if I query "Belgrade" it will return result.

It will also return words that end on search term, but not if search term is in the middle of the word.

Here's mine sphinx conf:

source src_cities
{
  type          = pgsql

  sql_host      = ####
  sql_user      = ####
  sql_pass      = ####
  sql_db        = ####
  sql_port      = 5432

  sql_query_pre = SET CLIENT_ENCODING TO 'UTF8';
  sql_query_pre = SET NAMES 'UTF8';

  sql_query     = \
  SELECT id,name \
  FROM cities

  sql_field_string = name

  sql_query_info        = SELECT * FROM cities WHERE id=$id
}
index cities
{
  source            = src_cities
  path              = /var/lib/sphinxsearch/data/cities
  docinfo           = extern
  charset_type      = sbcs
  min_word_len      = 1

}

And here's how I'm trying to get data from Laravel:

$results = $sphinx->search($name, 'cities')
            ->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_EXTENDED)
            ->query();

Upvotes: 0

Views: 376

Answers (1)

Forhad Ahmed
Forhad Ahmed

Reputation: 1771

This thread is related:

http://sphinxsearch.com/forum/view.html?id=3795

  # min-prefix lenght. optional. default is 0 (do not index prefixes)
  #
  min_prefix_len = 3

Upvotes: 1

Related Questions