Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sphinx and wordforms

Tags:

sphinx

How could I make Sphinx to recognize "auto" and "car" as similar words?

Let's image I have three database records

Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.

Here is sample queries and it's results...

query: car
result: Mary don't like to drive car.
-------------------------------------
query: auto
result: Andy likes to drive auto.
-------------------------------------
query: automobile
Bob is going to buy automobile.

..but I want sphinx to return...

query: car
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.
-------------------------------------
query: auto
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.
-------------------------------------
query: automobile
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.

I know that Sphinx have stowords, but what should I put into stopwords dictionary to make Sphinx think this way?

Thank you.

like image 582
Kirzilla Avatar asked Jul 10 '26 16:07

Kirzilla


1 Answers

all you have to do is supply sphinx with a correctly-formatted text file of wordforms in your .conf file.

documentation found here: http://www.sphinxsearch.com/docs/manual-0.9.9.html#conf-wordforms

auto > car
automobile > car
four-wheeled-vehicle-intended-for-public-roads > car
cars > car
like image 135
Ty W Avatar answered Jul 14 '26 12:07

Ty W



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!