stopwords index parameter
When you specify a customized stopword list, it replaces the default stopword list. You create a customized stopword list with the stopwords index parameter when you create the bts index.
Element | Description |
---|---|
column | The name of the column that contains stopwords. |
directory | The path for the stopwords file. |
field | The XML tag, path, or the column name that is indexed. |
filename | The name of the file that contains stopwords. |
table | The name of the table that contains stopwords. |
word | The term to use as a stopword. Stopwords must be lowercase. |
Usage
You can create a stopword list for all fields or customized stopword lists for specific fields. Any words that are listed before any field names become the default stopword list, which is used for all fields not explicitly listed. All words that are listed after a field name and before the next field name are stopwords for the preceding field only. If a field is listed without any words following it, that field does not have a stopword list.
You can specify the list of stopwords in a table column or in a file. The file or table must be readable by the user who is creating the index. Separate the field name and stopword pairs in the file or table by commas, white spaces, new lines, or a combination of those separators. The file or table becomes read-only when the index is created. If you want to add or change stopword assignments, you must drop and re-create the index.
Examples
- Example 1: Input stopwords as inline comma-separated words
- Inline comma-separated words are useful when you have only a few stopwords. The following example prevents searching the words "am,", "be," and "are":
stopwords="(am,be,are)"
The following example shows how to create a bts index with an inline comma-separated customized stopword list:CREATE INDEX books_bts ON books(book_data bts_lvarchar_ops) USING bts(stopwords="(am,be,are)") IN bts_sbspace;
- Example 2: Input stopwords from a file or a table column
- The following example shows the contents of a stopword file where stopwords are separated by commas, white spaces, and new lines:
avec, et mais pour
The following example shows how to create a bts index with a customized stopword list in a file:CREATE INDEX books_bts ON books(book_data bts_lvarchar_ops) USING bts(stopwords="file:/docs/stopwords.txt") IN bts_sbspace;
The following example shows how to create a bts index with a customized stopword list in a table column:CREATE INDEX books_bts ON books(book_data bts_lvarchar_ops) USING bts(stopwords="table:mytable.mycolumn") IN bts_sbspace;
- Example 3: Create stopword lists for specific fields
The following example creates a stopword list of
am
,be
, andare
for all fields except the fieldsauthor
andtitle
, which have their own stopwords, and the fieldedition
, which does not have any stopwords.CREATE INDEX books_bts ON books(book_data bts_lvarchar_ops) USING bts(stopwords= "(am,be,are, author:mrs,mr,ms, title:the,an,a,or, edition:)" ) IN bts_sbspace;