ISearchQueryHelper::put_QueryContentLocale method

Sets the language code identifier (LCID) of the query.


HRESULT put_QueryContentLocale(
  LCID lcid



Type: LCID

Sets the LCID of the query.

Return value


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


The locale identifier has the components necessary to uniquely identify one of the installed system-defined locales. The LCID controls a number of settings including numeric format, date format, currency format, uppercase and lowercase mapping, dictionary sort ordering, tokenization, and others. Although these settings help Windows operating system and Windows Search API provide excellent localized support, unexpected results can occur when documents from one locale are searched by a system set for another locale.

When the IFilter object processes a document's text properties and content, it reports the language of that document to the content indexer. Using this information, the Search API can apply the appropriate word breaker and noise-words list.

The locale is used for word breaking, normalizing, and stemming the string values that are extracted from the query string. If this method is not used (so the content locale is not set), ISearchQueryHelper::get_QueryContentLocale returns the active input locale.

The DSearch code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to create a class for a static console application to query Windows Search using the Microsoft.Search.Interop assembly for ISearchQueryHelper.


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



Querying the Index Programmatically

Querying the Index with Windows Search SQL Syntax