Term order in FREETEXTTABLE in SQL Server

327 views Asked by At

From the documentation, it seems that SQL Server's FREETEXTTABLE should treat a search query containing multiple words as a bag-of-words.

If I run:

SELECT *
FROM FREETEXTTABLE(tblThings, *, 'Cartridge Black')

I get results where the word 'Cartridge' is immediately followed by the word 'Black', e.g.:

EPSON STYLUS INKJET CARTRIDGE BLACK
INKJET CARTRIDGE BLACK 40ML

No results have the words in the other order.

If instead I run

SELECT *
FROM FREETEXTTABLE(tblThings, *, 'Black Cartridge')

I get a different set of results:

AD1020BK BLACK CARTRIDGE
GD230X BLACK CARTRIDGE

In neither set of results would I find 'black ink cartridge'.

Is there a way to make SQL Server disregard the order of the words?

1

There are 1 answers

0
Kumar_2002 On

Use freetext or conatins

SELECT *
FROM FREETEXT(tblThings, *, 'Cartridge Black')