SearchServiceApplication.AddContextValueFromKeyForTuningQuery method
Adds a context value for the given TuningQuery. A context refers to any property in a query and each property has a dynamically allocated ID. In this method only two properties are used: the user issuing the query (UserId) and the user’s language (LanguageId). The dynamically allocated ID may be 0 or 1.
Namespace: Microsoft.Office.Server.Search.Administration
Assembly: Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
Syntax
'Declaration
Public Function AddContextValueFromKeyForTuningQuery ( _
searchObjectOwner As SearchObjectOwner, _
QueryId As Integer, _
ContextKey As String, _
ContextVal As String _
) As Integer
'Usage
Dim instance As SearchServiceApplication
Dim searchObjectOwner As SearchObjectOwner
Dim QueryId As Integer
Dim ContextKey As String
Dim ContextVal As String
Dim returnValue As Integer
returnValue = instance.AddContextValueFromKeyForTuningQuery(searchObjectOwner, _
QueryId, ContextKey, ContextVal)
public int AddContextValueFromKeyForTuningQuery(
SearchObjectOwner searchObjectOwner,
int QueryId,
string ContextKey,
string ContextVal
)
Parameters
searchObjectOwner
Type: Microsoft.Office.Server.Search.Administration.SearchObjectOwnerThe owner of the search site hierarchy.
QueryId
Type: System.Int32The tuning query; a query that you can use to customize the ranking model.
ContextKey
Type: System.StringThe context key; either “LanguageId” or “UserId”.
ContextVal
Type: System.StringThe context value.
Return value
Type: System.Int32
The result. 0 indicates successful; -1 indicates an error.
Remarks
Use this method if you know the key of your property, e.g. UserId or LanguageId. Otherwise, use AddContextValueFromIdForTuningQuery().
Typically if there are multiple users and multiple queries, the most common user or query will be chosen. A TuningQuery can only have 1 user and 1 language.
See also
Reference
SearchServiceApplication class