Find Unique Words in One or More Columns?

余生长醉 提交于 2019-12-22 09:48:17

问题


I'm looking at implementing tags in my ASP.NET website. After looking at several algorithms, I'm leaning towards having a couple of database columns that contain one or more tag words. I will then use full-text search to locate rows with specified tags.

All of this seems pretty straight forward except for one thing: I need to be able to generate a list of available tags, which the user can select from.

I know I can write a C# program to build the list of available tags, and then run it once every week or so, but I was just wondering if there's any SQL-method for doing stuff like this more efficiently.

Also, I can't help but notice that the words will be extracted anyway as part of building the full-text index. I don't suppose there's any way to access that information?


回答1:


This isn't how I'd choose to structure this but to answer the actual question...

In SQL Server 2008 you can query the sys.dm_fts_index_keywords and sys.dm_fts_index_keywords_by_document table valued functions to get the information that you want.




回答2:


Why not to use separate table for tags with many-to-many relationship with tagged items table? I mean something like that:

--Articles
ArticleId
Text

--Tags
TagId
Name

--TagsToArticles
ArticleRef
TagRef


来源:https://stackoverflow.com/questions/4718905/find-unique-words-in-one-or-more-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!