tags:

views:

197

answers:

1

Hello,

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.

+1  A: 

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
Ty W
Yeah, I've already checked the manual about wordforms. But I can't understand what shoud I do to equate this words. Should I put car > auto, car > automobile, auto > car, auto > automobile, automobile > car, automobile > auto ? Or any less complicated way? Thank you.
Kirzilla
the syntax is [consider this word] > [as this word]. As I tried to demonstrate in my example code you want to use car as the form for each of the other words so that they are all equivalent to sphinx. Remember that stemming is not performed on wordforms so plurals and such will have to be specified explicitly.
Ty W
I've asked the same question at http://sphinxsearch.com/forum/view.html?id=5134 and you've answered simultaneusly. :)
Kirzilla

related questions