如何获取我的FullText目录中使用的StopWords列表?

Gui*_*tos 8 .net c# sql-server full-text-search stop-words

有没有办法获得我的SQL Server 2008 FullText目录使用的StopWord列表?在我的C#代码隐藏中使用它?

我想在我用来搜索术语并突出显示它们的ASP.NET页面中使用它.

搜索页面和突出显示已经正常工作,但我想改进突出显示.我不想突出显示在我的StopWord列表中的单词.

Sem*_*nen 8

在sql server management studio中,如果从全文索引中询问属性,则可以看到它使用的停止列表.看到这里.

然后,您可以使用系统视图sys.fulltext_stoplistssys.fulltext_stopwords来获取停用词列表.

  • `sys.fulltext_system_stopwords`中也有默认值.请参阅http://mssqltipsandtricks.blogspot.com/2012/07/noisestop-words-in-sql-server.html (3认同)

jas*_*tim 7

SELECT*FROM sys.fulltext_stopwords |
SELECT*FROM sys.fulltext_system_stopwords

您可以通过在where子句中包含语言代码来过滤返回的停止列表

例如SELECT*FROM sys.fulltext_system_stopwords WHERE language_id = 1033

(id 1033对应syslanguages'英文')

或者,可以在"存储"组中的"全文停止列表"类别下针对标准SQL数据库找到这些内容


Ant*_*ray 6

看来正在使用的活动非索引字表已在 SQL 的更高版本中从 GUI 中删除 - 因此 Sem 的正确答案现在已经过时了。在 SQL Server Management Studio 中,我无法找到特定全文目录正在使用哪个非索引字表。

经过大量挖掘后,以下查询将轻松提供每个全文目录使用的非索引字表:

select so.name as tableName, sfc.name as fullTextCatalogName, sfi.is_enabled, sfi.stoplist_id, sfs.name as stoplistName
from sys.fulltext_indexes as sfi
         left join sys.objects as so on so.object_id = sfi.object_id
         left join sys.fulltext_catalogs as sfc on sfc.fulltext_catalog_id = sfi.fulltext_catalog_id
         left join sys.fulltext_stoplists as sfs on sfi.stoplist_id = sfs.stoplist_id
Run Code Online (Sandbox Code Playgroud)

因此,如果 stoplist_id 为 0 - 这表明该目录正在使用“默认”系统非索引字表。如果 stoplist_id 为 NULL,则表示没有使用非索引字表(即 ALTER FULLTEXT INDEX ON {{TABLENAME}} SET STOPLIST = OFF)。

正如另一个答案中所示 - 如果您想额外列出给定语言的默认系统非索引字列表中的非索引字(假设此处为英语),您可以:

SELECT * FROM sys.fulltext_system_stopwords WHERE language_id=1033
Run Code Online (Sandbox Code Playgroud)

...查看包含用户定义的非索引字列表 ID 的列表:

SELECT * from sys.fulltext_stoplists
Run Code Online (Sandbox Code Playgroud)

...如果您想查看用户定义的非索引字列表中有哪些非索引字:

SELECT * from sys.fulltext_stopwords where language_id = 1033 and stoplist_id = {{a_valid_stoplist_id}}
Run Code Online (Sandbox Code Playgroud)

我希望这会有所帮助,因为我必须在我的应用程序上修复其中的一些问题 - 并开始真正绞尽脑汁试图找到索引的活动非索引字表所在的位置 - 因为我习惯于右键单击 -> 属性旧版本的 MSSQL...