Search

Thursday, July 28, 2011

Fulltext syntax

These are code examples on how to use fulltext search.

The "*" in WHERE CONTAINS(*, ' "backups" ') can be changed to any column you have fulltext search on. With the "*" you will search on all column with fulltext on the given catalogue. You only have to use "" with space separated criterias, like "red car". For single words you can omit it but in many cases it can be easier to have it on all words.

SELECT *
FROM sqlcode
WHERE CONTAINS(*, ' "backups" ')

You can also use wildcards:

SELECT *
FROM sqlcode
WHERE CONTAINS(*, ' "back*" ')

This code will handle inflections and all forms of a word, e.g. singularis, pluralis etc.

SELECT *
FROM sqlcode
WHERE CONTAINS (*, 'FORMSOF(INFLECTIONAL, "backups")')

Words who are close to each other can be catched with this code:

SELECT *
FROM sqlcode
WHERE CONTAINS (*, '"backup" NEAR "disk"')

Find one word wihout the other.
SELECT *
FROM sqlcode
WHERE CONTAINS (*, 'backup and not disk')

Normal OR case.

SELECT *
FROM sqlcode
WHERE CONTAINS (*, 'backup or disk')

No comments:

Post a Comment