Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Searching for Words or Phrases Using Weighted Values (Weighted Term)

You can search for words or phrases and specify a weighting value. Weight, measured as a number from 0.0 through 1.0, indicates the degree of importance for each word and phrase within a set of words and phrases. A weight value of 0.0 is the lowest, and a weight value of 1.0 is the highest. For example, this query searches for all customer addresses, using weight values, in which any text beginning with the string "Bay" has either "Street" or "View". Microsoft SQL Server 2005 gives a higher rank to those rows with more of the words specified.

USE AdventureWorks
GO
SELECT AddressLine1, KEY_TBL.RANK 
FROM Person.Address AS Address INNER JOIN
CONTAINSTABLE(Person.Address, AddressLine1, 'ISABOUT ("Bay*", 
         Street WEIGHT(0.9), 
         View WEIGHT(0.1)
         ) ' ) AS KEY_TBL
ON Address.AddressID = KEY_TBL.[KEY]
ORDER BY KEY_TBL.RANK
GO

A weighted term can be used in conjunction with any of the other four types of terms, namely simple term, prefix term, generation term, and proximity term.

Community Additions

ADD
Show:
© 2015 Microsoft