开发者

SQL Server FullText - Getting Keyterms out given a row and Column

开发者 https://www.devze.com 2023-03-29 13:56 出处:网络
Imagine I have a Table full of Cars, with Columns Id,Title and Description. These are all in a FullText index.

Imagine I have a Table full of Cars, with Columns Id,Title and Description. These are all in a FullText index.

Now given I have the Id of t开发者_StackOverflowhe Car I want to get a list of all the Keyterms in the Title or Description from the FullText index.

I've got as far as

DECLARE @table_id int = OBJECT_ID(N'Cars');
EXEC sp_fulltext_keymappings @table_id;

which gets me the key (which I'm assuming is the id for the list of keywords given the docid (which I'm assuming is my tables column?)

I just need the list of keyterms. Then ideally the occurrence as well.

Thanks


Someone at work (Thanks Natalia) supplied the magic answer:

select * FROM sys.dm_fts_index_keywords_by_document (DB_ID('CarDatabase'),OBJECT_ID('Cars'))
WHERE Document_id = 2039468
0

精彩评论

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

关注公众号