Find unique words in one or more columns?

I am looking for a tag implementation on my ASP.NET website. Having looked at several algorithms, I tend to have multiple database columns that contain one or more tags. Then I will use full-text search to search for strings with the specified tags.

All this seems pretty straightforward, with one exception: I need to be able to generate a list of available tags that the user can select.

I know that I can write a program in C # to create a list of available tags, and then run it once a week or so, but I'm just wondering if there is any SQL method for using such things more efficiently.

In addition, I cannot help but notice that the words will be extracted anyway as part of the construction of a full-text index. I don’t think there is any way to access this information?

+3
source share
2 answers

This is not how I would decide to structure it, but to answer the real question ...

In SQL Server 2008, you can query functions sys.dm_fts_index_keywordsand sys.dm_fts_index_keywords_by_document table functions to get the information you need.

+1
source

Why not use a separate table for tags with a many-to-many relationship with a table with tags? I mean something like this:

--Articles
ArticleId
Text

--Tags
TagId
Name

--TagsToArticles
ArticleRef
TagRef
+1
source

Source: https://habr.com/ru/post/1786020/


All Articles