containstable ignores noise word 'of' while searching

904 views Asked by At

I am searching in the DB table with containstable. I am searching with text 'center of gravity', but it doesn't return result. If I search with only 'center' or 'gravity', then it returns the result.

How can to overcome this situation?

select * from containstable(swInstances, *, '"*Center of gravity*"')
1

There are 1 answers

0
Gordon Linoff On

I think the problem are the positions of the words. containstable is taking into account the position of the stop words, so "center" and "gravity" are not next to each other. However, "of" is removed from the search term.

Two solutions come to mind. The first is to use near (see here) and allow one stop word of separation. Of course, this would find "center for gravity" as well.

The second is to eliminate stop words from the search index entirely, so phrases like "center of gravity" can be directly searched.

I'm not sure which is more applicable in your situation. If I had to guess, near might be good enough.