ALTER SEARCH PROPERTY LIST (Transact-SQL)
Adds a specified search property to, or drops it from the specified search property list.
Important
|
|---|
|
CREATE SEARCH PROPERTY LIST, ALTER SEARCH PROPERTY LIST, and DROP SEARCH PROPERTY LIST are supported only under compatibility level 110. Under lower compatibility levels, these statements are not supported. |
Each full-text index can have only one search property list.
To enable querying on a given search property, you must add it to the search property list of the full-text index and then repopulate the index.
When specifying a property you can arrange the PROPERTY_SET_GUID, PROPERTY_INT_ID, and PROPERTY_DESCRIPTION clauses in any order, as a comma-separated list within parentheses, for example:
ALTER SEARCH PROPERTY LIST CVitaProperties
ADD 'System.Author'
WITH (
PROPERTY_DESCRIPTION = 'Author or authors of a given document.',
PROPERTY_SET_GUID = 'F29F85E0-4FF9-1068-AB91-08002B27B3D9',
PROPERTY_INT_ID = 4
);
Note
|
|---|
|
This example uses the property name, System.Author, which is similar to the concept of canonical property names introduced in Windows Vista (Windows canonical name). |
Obtaining Property Values
Full-text search maps a search property to a full-text index by using its property set GUID and property integer ID. For information about how to obtain these for properties that have been defined by Microsoft, see Find Property Set GUIDs and Property Integer IDs for Search Properties. For information about properties defined by an independent software vendor (ISV), see the documentation of that vendor.
Making Added Properties Searchable
Adding a search property to a search property list registers the property. A newly added property can be immediately specified in CONTAINS queries. However, property-scoped full-text queries on a newly added property will not return documents until the associated full-text index is repopulated. For example, the following property-scoped query on a newly added property, new_search_property, will not return any documents until the full-text index associated with the target table (table_name) is repopulated:
SELECT column_name FROM table_name WHERE CONTAINS( PROPERTY( column_name, 'new_search_property' ), 'contains_search_condition');
GO
To start a full population, use the following ALTER FULLTEXT INDEX (Transact-SQL) statement:
USE database_name;
GO
ALTER FULLTEXT INDEX ON table_name START FULL POPULATION;
GO
Note
|
|---|
|
Repopulation is not needed after a property is dropped from a property list, because only the properties that remain in the search property list are available for full-text querying. |
A. Adding a property
The following example adds several properties—Title, Author, and Tags—to a property list named DocumentPropertyList.
Note
|
|---|
|
For an example that creates DocumentPropertyList property list, see CREATE SEARCH PROPERTY LIST (Transact-SQL). |
ALTER SEARCH PROPERTY LIST DocumentPropertyList
ADD 'Title'
WITH ( PROPERTY_SET_GUID = 'F29F85E0-4FF9-1068-AB91-08002B27B3D9', PROPERTY_INT_ID = 2,
PROPERTY_DESCRIPTION = 'System.Title - Title of the item.' );
ALTER SEARCH PROPERTY LIST DocumentPropertyList
ADD 'Author'
WITH ( PROPERTY_SET_GUID = 'F29F85E0-4FF9-1068-AB91-08002B27B3D9', PROPERTY_INT_ID = 4,
PROPERTY_DESCRIPTION = 'System.Author - Author or authors of the item.' );
ALTER SEARCH PROPERTY LIST DocumentPropertyList
ADD 'Tags'
WITH ( PROPERTY_SET_GUID = 'F29F85E0-4FF9-1068-AB91-08002B27B3D9', PROPERTY_INT_ID = 5,
PROPERTY_DESCRIPTION = 'System.Keywords - Set of keywords (also known as tags) assigned to the item.' );
Note
|
|---|
|
You must associate a given search property list with a full-text index before using it for property-scoped queries. To do so, use an ALTER FULLTEXT INDEX statement and specify the SET SEARCH PROPERTY LIST clause. |
B. Dropping a property
The following example drops the Comments property from the DocumentPropertyList property list.
ALTER SEARCH PROPERTY LIST DocumentPropertyList DROP 'Comments' ;
Important