开发者

SQL Server 2005. Full Text Search. Need Thesaurus working with NEAR/AND/OR keywords

开发者 https://www.devze.com 2022-12-25 09:52 出处:网络
does anyone know if it\'s possible to do a thesaurus search together with NEAR or AND/OR keywords. Here is an example of the type of query I want to run:

does anyone know if it's possible to do a thesaurus search together with NEAR or AND/OR keywords. Here is an example of the type of query I want to run:

    SELECT Title, RANK
            FROM Item INNER 开发者_C百科JOIN
            CONTAINSTABLE(Item, Title, 'FORMSOF(Thesaurus, "red" NEAR "wine")') AS KEY_TBL
            ON Item.ItemID = KEY_TBL.[KEY]
    ORDER BY RANK DESC

....But I get the error message:

Syntax error near 'NEAR' in the full-text search condition 'FORMSOF(Thesaurus, "red" NEAR "wine")'.


Near and FormsOf don't work well with each other. Read the following link Is it possible to combine NEAR and FORMSOF together in a fulltext search?

use IsAbout

SELECT   K.RANK, name, Description
FROM      Diagnosis AS C
INNER JOIN
CONTAINSTABLE(diagnosis,name, 'ISABOUT (
FORMSOF(Thesaurus, "red"),
FORMSOF(Thesaurus, "wine"))', 50) AS K
ON C.ID = K.[KEY];
GO


The syntax of thesaurus is slightly different, you you might be looking for is something like:

SELECT Title, RANK
            FROM Item INNER JOIN
            CONTAINSTABLE(Item, Title, 'FORMSOF(Thesaurus, "red") NEAR FORMSOF(Thesaurus, "wine")') AS KEY_TBL
            ON Item.ItemID = KEY_TBL.[KEY]
    ORDER BY RANK DESC
0

精彩评论

暂无评论...
验证码 换一张
取 消