ISearchQueryHelper::put_QuerySorting method (searchapi.h)

Sets the sort order for the query result set.

Syntax

HRESULT put_QuerySorting(
  [in] LPCWSTR pszSorting
);

Parameters

[in] pszSorting

Type: LPCWSTR

A comma-delimited, null-terminated Unicode string that specifies the sort order.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

ppszSorting must be a valid ORDER BY clause (without the ORDER BY keyword). Windows Search SQL supports sorting on multiple properties, in either ascending (ASC) or descending (DESC) order on each property. For example, ppszSorting might contain the following:

System.ItemAuthors ASC, System.ItemDate DESC

Checkout the DSearch code sample to see how to create a class for a static console application to query Windows Search using the Microsoft.Search.Interop assembly for ISearchQueryHelper.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header searchapi.h
Redistributable Windows Desktop Search (WDS) 3.0

See also

ISearchQueryHelper

ISearchQueryHelper::get_QuerySorting

Querying the Index Programmatically

Querying the Index with Windows Search SQL Syntax