RANK BY Clause

RANK BY Clause

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release. The Structured Query Language (SQL) RANK BY clause can be used to sort results based on how frequently and where the queried strings appear in the indexed documents.

Syntax

RANK BY CLAUSE (Mechanism, Weight)

The parameter CLAUSE is either WEIGHT or COERCION.

The parameter Mechanism is an action, such as WEIGHT or MULTIPLY.

The parameter Weight specifies the significance of the rank by assigning a numerical value between 0 and 1.

Example

This example contains a SQL search string that uses clause weighting to assign certain search terms a fraction of the weight that other search terms have. The example searches all properties on the items for the term "Star" and the term "Planet." If the search engine finds only "Star" in an item, it should rank that item at one-quarter the value of an item containing "Planet."

The rank Field holds the relevant rank of search results.

strSQL = "Select ""urn:schemas:httpmail:subject"", " & """urn:schemas.microsoft.com:fulltextqueryinfo:rank"" 
strSQL = strSQL & "FROM scope('shallow traversal of "http://myserver/public/test/""')" 
strSQL = strSQL & "WHERE " & "CONTAINS(*.'""Star""')" 
strSQL = strSQL & "RANK BY WEIGHT(0.25) OR " & "CONTAINS(*,'""Planet""') RANK BY WEIGHT(1.0)"

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.