SearchServiceApplication.AddContextValueFromIdForTuningQuery method

SharePoint 2013

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)

public int AddContextValueFromIdForTuningQuery(
	SearchObjectOwner searchObjectOwner,
	int QueryId,
	int ContextId,
	string ContextVal


Type: Microsoft.Office.Server.Search.Administration.SearchObjectOwner

The owner of the search site hierarchy.

Type: System.Int32

The tuning query; a query that you can use to customize the ranking model.

Type: System.Int32

The context ID; either 0 or 1.

Type: System.String

The context value.

Return value

Type: System.Int32
The result. 0 indicates successful; -1 indicates an error.

Use this method if you know the ID of your property. Otherwise, use AddContextValueFromKeyForTuningQuery().

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.