Paul
Paul

Reputation: 16853

Term order in FREETEXTTABLE in SQL Server

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?

Upvotes: 0

Views: 330

Answers (1)

Kumar_2002
Kumar_2002

Reputation: 604

Use freetext or conatins

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

Upvotes: 0

Related Questions