SharePoint Portal Server Default Query
The default query runs through the Search Web Part on the SharePoint Portal Server dashboard site and uses the probabilistic ranking feature of the search engine provided in the Search service, in addition to properties exposed through the SharePoint Portal Server schema. The default query is composed of two query strings executed in parallel. The first performs a query on matching categories. The second performs a query for best bets and matching documents.
The default query performs matches for both Best Bets and normal document matches, and, through rank coercion, functions and attribute weighting, coerces results into groupings. Attribute weighting has the effect of giving more weight to some attributes than to others, and thus promotes relevance for documents that are not marked as Best Bets. The default query returns results that are ranked according to relevance. These results display on the dashboard site according to their rank, with the top five Best Bets appearing first.
The rank for a document measures the relevance between the document and a query. On the dashboard site, the determined rank for a document indicates the order in which the document appears in query results. Weighting is the ability to adjust ranking relative to the parameters specified for the query. For example, attribute weighting, you can specify that documents that contain a query term in the document title rank higher than those that contain the term only in the document body.
Syntax for Default Query Category Matching
The category portion of the default query searches category name, keywords, subject, title, and description and returns a list of links to relevant category folders. Users can browse categories from the result list on the dashboard site.
The following example, written in Search SQL, demonstrates how the default query for the dashboard site performs category matches.
SELECT "DAV:href", "DAV:displayname", "DAV:contentclass",
"urn:schemas-microsoft-com:office:office#Category",
"urn:schemas-microsoft-com:office:office#Description"
FROM workspace..SCOPE()
WHERE WITH
("urn:schemas-microsoft-com:office:office#Keywords":1.0,
"urn:schemas-microsoft-com:office:office#Subject":1.0,
"urn:schemas-microsoft-com:office:office#Title":1.0,
"urn:schemas.microsoft.com:fulltextqueryinfo:description":1.0 )
AS #WeightedCatProps
(FREETEXT(#WeightedCatProps, 'SharePoint Portal Server')
OR CONTAINS("DAV:displayname", '"SharePoint Portal Server"'))
AND ("DAV:contentclass" = 'urn:content-classes:categoryfolder')
ORDER BY "urn:schemas-microsoft-com:office:office#Category" ASC
The category search is only executed against the primary workspace and does not include propagated indexes or Dedicated Content Indexes (DCIs). This restriction is made to improve category search latency.
Syntax for Default Query Document Matching
The default query combines CONTAINS and FREETEXT matches on the BestBetsKeyword property with FREETEXT matches on a small selection of weighted properties that are given attribute weight. The query distinguishes between properties that are known to be good indicators of content, such as Title, Description, or Keywords, and other properties that appear in the full-text index.
The following table shows the properties used as good indicators for content in the default query, and the weight they receive.
Note
Properties and attribute weights used in the default query for the dashboard site are subject to change.
Property | Weight |
---|---|
urn:schemas-microsoft-com:office:office#Author | 0.5 |
urn:schemas-microsoft-com:office:office#Keywords | 0.8 |
urn:schemas-microsoft-com:office:office#Subject | 0.8 |
urn:schemas-microsoft-com:office:office#Title | 0.8 |
urn:schemas.microsoft.com:fulltextqueryinfo:description | 0.8 |
The default query coerces some overlap between the result sets for the three predicates so that very relevant matches can be promoted into the Best Bet matches displayed on the dashboard site. To avoid having Best Bets intermixed with document results, the coercion is performed on a predicate basis. The dashboard site Results Web Part displays best bets with a rank of over 500.
The following table shows the three default query predicates and the rank they receive.
Note
Query predicates and rank coercion functions used in the default query for the dashboard site are subject to change.
Predicate | Rank |
---|---|
CONTAINS on BestBetKeywords | 1000/999 |
FREETEXT on BestBetKeywords | 500-999 |
FREETEXT on selected list of properties | 0-600 |
The results from the default query get normalized and ordered by rank.
The following example, written in Search SQL, demonstrates the Best Bets are determined in the document-matching portion of the default query. The query is for "SharePoint Portal Server".
SELECT "DAV:href", "DAV:displayname", "DAV:getlastmodified", "DAV:iscollection", "urn:schemas-microsoft-com:office:office#Title",
"urn:schemas-microsoft-com:office:office#Author", "urn:schemas.microsoft.com:fulltextqueryinfo:description",
"urn:schemas-microsoft-com:publishing:ShortcutTarget",
"urn:schemas-microsoft-com:publishing:isdoclibrarycontent",
"urn:schemas-microsoft-com:publishing:DiscussionTarget", "urn:schemas.microsoft.com:fulltextqueryinfo:rank"
FROM SCOPE('DEEP TRAVERSAL OF "/workspace"')
WHERE WITH ( Contents:0.5, "urn:schemas-microsoft-com:office:office#Author":0.5,
"urn:schemas-microsoft-com:office:office#Keywords":0.8,
"urn:schemas-microsoft-com:office:office#Subject":0.8,
"urn:schemas-microsoft-com:office:office#Title":0.8, "urn:schemas.microsoft.com:fulltextqueryinfo:description":0.8)
AS #WeightedProps
((CONTAINS("urn:schemas-microsoft-com:publishing:BestBetKeywords",
'"SharePoint Portal Server"') RANK BY COERCION(absolute, 999))
OR ((FREETEXT("urn:schemas-microsoft-com:publishing:BestBetKeywords",
'SharePoint Portal Server') RANK BY COERCION(multiply, 0.5)) RANK BY COERCION(add, 500))
OR ((FREETEXT(#WeightedProps, 'SharePoint Portal Server')
OR CONTAINS("DAV:displayname", '"SharePoint Portal Server"'))
RANK BY COERCION(multiply, 0.6)) )
AND NOT ("DAV:contentclass" = 'urn:content-classes:categoryfolder')
AND NOT ("DAV:contentclass" = 'urn:content-classes:rootcategoryfolder')
ORDER BY "urn:schemas.microsoft.com:fulltextqueryinfo:rank" DESC
If a document whose content class contains a BestBetKeyword property with the value "SharePoint Portal Server", that document is returned in the top band as an exact match. If a document whose content class contains a BestBetKeyword property has the value "SharePoint", that document is returned in the middle band. If a document whose custom property, "Product", has the value "SharePoint Portal Server", that document is returned in the last band.
Category folders are excluded from these results, as they are included in the category portion of the default query.
Modifying the Default Query
You can modify limited portions of the default query. Reasons for modifying the default query include adding custom properties to the weighted property list, modifying the weight for a given property, or adjusting the rank coercion functions.
The following table shows the weighted property aliases declared in Portal\resources\searchConstants.js, with a brief description of modifications that can be made.
Variable | Description |
---|---|
g_strWeightedPropsWhereClauseDeclaration | Modify the properties and weights used in the Best Bets and matching documents portion of the default query. |
g_strWeightedCatPropsWhereClauseDeclaration | Modify properties used in the Categories portion of the default query. |
The JavaScript code that generates the query can be found at the following path on the dashboard site: Portal\resources\searchFunctions.js.
Warning
Changes to the default query are not supported. Any changes made should adhere to the following guidelines:
- Do not remove any properties selected by the query. Doing so interferes with the function of XSL style sheets and code on the dashboard site.
- Do not alter the rank of the Best Bet predicates.
- Adding properties to the property list or ordering the query by an attribute other than rank impacts query latency.