Posts make a stoplist and exclude a word
Post
Cancel

make a stoplist and exclude a word

When a table has the fulltext enabled, this menu command is active snap152

in properties, you can choose what stoplist will use or even disable it. snap153

The system default stoplist cant be edited or deleted, the only trick, is to copy it, to a new custom stoplist and update the custom stoplist. or disable it!

1
2
3
4
5
6
7
8
9
10
11
--create a custom stoplist + copy system_stoplist
CREATE FULLTEXT STOPLIST myStopList 
FROM SYSTEM STOPLIST; 

--drop any word you like
ALTER FULLTEXT STOPLIST myStopList 
DROP 'to' language 1033 ;  --1032 is GREEK

--attach the stoplist to table
ALTER FULLTEXT INDEX ON Customers
SET STOPLIST myStopList

Disable STOPLIST on table

jsALTER FULLTEXT INDEX ON Customers SET STOPLIST = OFF;


source - https://sqlserverperformance.wordpress.com/2009/07/21/some-useful-full-text-index-stoplist-related-queries/

Stoplists are used in SQL Server Full Text Indexes to exclude common “noise” words (such as to, the, etc.) from filling up the index with information that is not very useful for Full Text Searches. By default, a new Full Text Index in SQL Server 2008 will use the system stoplist, which has about 15K different words in it.

You can create your own stoplist, either from scratch or by copying the system stoplist into it. Then you can modify your stoplist as you see fit, by adding or removing words. You can then change a Full Text Index to use your custom stoplist. You will have to repopulate the full text index for the new stoplist to take full effect.

At any rate, here are some useful queries if you need to manipulate your stoplist(s).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- source - https://sqlserverperformance.wordpress.com/2009/07/21/some-useful-full-text-index-stoplist-related-queries/
-- Some Useful FT Related Stoplist Queries
-- Glenn Berry    7/21/2009

-- Get base table names, FTCatalogNames and change tracking type
SELECT t.name AS [TableName], c.name AS [FTCatalogName], c.fulltext_catalog_id, 
       i.change_tracking_state_desc
FROM sys.tables AS t 
INNER JOIN sys.fulltext_indexes AS i 
ON t.object_id = i.object_id 
INNER JOIN sys.fulltext_catalogs AS c 
ON i.fulltext_catalog_id = c.fulltext_catalog_id;

-- Get all the non-system stoplists
SELECT stoplist_id, name 
FROM sys.fulltext_stoplists;

-- Create a stoplist from the system stoplist
CREATE FULLTEXT STOPLIST NewsGatorSL 
FROM SYSTEM STOPLIST; 

-- Look for a term in the stoplist
SELECT stoplist_id, stopword, [language], language_id 
FROM sys.fulltext_stopwords 
WHERE stopword = 're'

-- Drop a stoplist
DROP FULLTEXT STOPLIST TestSL;

-- Drop a term from a stoplist
ALTER FULLTEXT STOPLIST NewsGatorSL 
DROP 're' LANGUAGE 1033; 

-- Change the stoplist for a fulltext index
ALTER FULLTEXT INDEX ON CurrentPostFullTextMonday  -- This is base table name
SET STOPLIST NewsGatorSL

-- Repopulate FT Index after changing stoplist
ALTER FULLTEXT INDEX ON dbo.CurrentPostFullTextMonday START UPDATE POPULATION
GO

-- Get document counts for a display term
SELECT display_term, column_id, document_count 
FROM sys.dm_fts_index_keywords(DB_ID('ngfulltext1'), OBJECT_ID('CurrentPostFullTextMonday'))
WHERE display_term = 'Re'

origin - http://www.pipiscrew.com/?p=3900 sql-make-a-stoplist-and-exclude-a-word

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags