ContentIndexer ContentIndexer ContentIndexer ContentIndexer Class

Enables Windows Store app to place content properties in the system index.

Syntax

Declaration

public sealed class ContentIndexerpublic sealed class ContentIndexerPublic NotInheritable Class ContentIndexerpublic sealed class ContentIndexer

Remarks

The index is a cache of searchable properties for data that's backed by storage elsewhere. Don't use the index as a primary data store.

Define properties for the index with string-object key-value pairs, where the keys are standard Windows property names, like System.Author, and the values are PropertyValue instances. The property must be registered on the system.

You query over content by using Advanced Query Syntax (AQS).

Also, you can provide full-text search content by using a stream and content type. This corresponds to running the IFilter implementation for the type and indexing the content.

For more information, see the Windows Property System.

Define properties for the index with string-object key-value pairs, where the keys are standard Windows property names, like System.Author, and the values are PropertyValue instances. The property must be registered on the system. The keys should be described as standard Windows property canonical names.

Content is separated per app package and per user. A package can't query another package's data, but the operating system can access the data.

Properties summary

Gets the version of the ContentIndexer.

Methods summary

Adds app-defined items with properties and content to the system index.

Builds a query with the specified search filter and identifies which properties to retrieve.

Builds a query with the specified search filter, sort order, and identifies which properties to retrieve.

Builds a query with the specified search filter, sort order, filter language, and identifies which properties to retrieve.

Removes all app-defined items from the ContentIndexer.

Removes the specified app-defined item from the ContentIndexer.

Removes the specified app-defined items from the ContentIndexer.

Gets an existing per-app index or creates a new one, if necessary.

Gets the per-app index with the specified name or creates a new one, if necessary.

Gets content properties based on the given content identifier.

Updates app content and properties in the ContentIndexer.

Properties

  • Revision
    Revision
    Revision
    Revision

    Gets the version of the ContentIndexer.

    public ulong Revision { get; }public ulong Revision { get; }Public ReadOnly Property Revision As ulongpublic ulong Revision { get; }

    Property Value

    • ulong
      ulong
      ulong
      ulong

      The revision number.

    Remarks

    Use the Revision property to track updates to the index.

    For example, it's possible that your app may have terminated prior to the index being committed. In many cases the app can resubmit all of its content, but for more sophisticated apps, like mail, where there's a large amount of content, the app can create its own checkpoints and re-index only the missing content. The app can track how much content has been indexed by tracking the revision number. The Revision property is a number that increments based on the indexing operations that the app has initiated.

    If the index is reset (which can be caused by either the index getting corrupted or a user manually clearing it out), the revision number will be "0". In this case, the app should re-push all of its data.

Methods

  • AddAsync(IIndexableContent)
    AddAsync(IIndexableContent)
    AddAsync(IIndexableContent)
    AddAsync(IIndexableContent)

    Adds app-defined items with properties and content to the system index.

    public IAsyncAction AddAsync(IIndexableContent indexableContent)public IAsyncAction AddAsync(IIndexableContent indexableContent)Public Function AddAsync(indexableContent As IIndexableContent) As IAsyncActionpublic IAsyncAction AddAsync(IIndexableContent indexableContent)

    Parameters

    Returns

  • CreateQuery(String, IIterable<String>)
    CreateQuery(String, IIterable<String>)
    CreateQuery(String, IIterable<String>)
    CreateQuery(String, IIterable<String>)

    Builds a query with the specified search filter and identifies which properties to retrieve.

    public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve)public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IIterable<String>) As ContentIndexerQuerypublic ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve)

    Parameters

    • searchFilter
      System.String
      System.String
      System.String
      System.String

      The Advanced Query Syntax (AQS) filter to apply.

    • propertiesToRetrieve

      The properties to retrieve, specified by their Windows canonical property names.

    Returns

    Remarks

    Call the GetPropertiesAsync() method to run the query.

  • CreateQuery(String, IIterable<String>, IIterable<SortEntry>)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>)

    Builds a query with the specified search filter, sort order, and identifies which properties to retrieve.

    public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder)public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IIterable<String>, sortOrder As IIterable<SortEntry>) As ContentIndexerQuerypublic ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder)

    Parameters

    • searchFilter
      System.String
      System.String
      System.String
      System.String

      The Advanced Query Syntax (AQS) filter.

    • propertiesToRetrieve

      The properties to retrieve, specified by their Windows canonical property names.

    • sortOrder

      The sort order for the filtered results.

    Returns

  • CreateQuery(String, IIterable<String>, IIterable<SortEntry>, String)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>, String)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>, String)
    CreateQuery(String, IIterable<String>, IIterable<SortEntry>, String)

    Builds a query with the specified search filter, sort order, filter language, and identifies which properties to retrieve.

    public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder, String searchFilterLanguage)public ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder, String searchFilterLanguage)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IIterable<String>, sortOrder As IIterable<SortEntry>, searchFilterLanguage As String) As ContentIndexerQuerypublic ContentIndexerQuery CreateQuery(String searchFilter, IIterable<String> propertiesToRetrieve, IIterable<SortEntry> sortOrder, String searchFilterLanguage)

    Parameters

    • searchFilter
      System.String
      System.String
      System.String
      System.String

      The Advanced Query Syntax (AQS) filter to apply.

    • propertiesToRetrieve

      The properties to retrieve, specified by their Windows canonical property names.

    • sortOrder

      The sort order for the filtered results.

    • searchFilterLanguage
      System.String
      System.String
      System.String
      System.String

      The language that's used to parse Advanced Query Syntax (AQS), specified as a BCP-47 language tag.

    Returns

  • DeleteAllAsync()
    DeleteAllAsync()
    DeleteAllAsync()
    DeleteAllAsync()

    Removes all app-defined items from the ContentIndexer.

    public IAsyncAction DeleteAllAsync()public IAsyncAction DeleteAllAsync()Public Function DeleteAllAsync() As IAsyncActionpublic IAsyncAction DeleteAllAsync()

    Returns

  • DeleteAsync(String)
    DeleteAsync(String)
    DeleteAsync(String)
    DeleteAsync(String)

    Removes the specified app-defined item from the ContentIndexer.

    public IAsyncAction DeleteAsync(String contentId)public IAsyncAction DeleteAsync(String contentId)Public Function DeleteAsync(contentId As String) As IAsyncActionpublic IAsyncAction DeleteAsync(String contentId)

    Parameters

    • contentId
      System.String
      System.String
      System.String
      System.String

      The identifier of the item to remove.

    Returns

  • DeleteMultipleAsync(IIterable<String>)
    DeleteMultipleAsync(IIterable<String>)
    DeleteMultipleAsync(IIterable<String>)
    DeleteMultipleAsync(IIterable<String>)

    Removes the specified app-defined items from the ContentIndexer.

    public IAsyncAction DeleteMultipleAsync(IIterable<String> contentIds)public IAsyncAction DeleteMultipleAsync(IIterable<String> contentIds)Public Function DeleteMultipleAsync(contentIds As IIterable<String>) As IAsyncActionpublic IAsyncAction DeleteMultipleAsync(IIterable<String> contentIds)

    Parameters

    • contentIds

      The identifier of the item to remove.

    Returns

  • GetIndexer()
    GetIndexer()
    GetIndexer()
    GetIndexer()

    Gets an existing per-app index or creates a new one, if necessary.

    public static ContentIndexer GetIndexer()public static ContentIndexer GetIndexer()Public Static Function GetIndexer() As ContentIndexerpublic static ContentIndexer GetIndexer()

    Returns

  • GetIndexer(String)
    GetIndexer(String)
    GetIndexer(String)
    GetIndexer(String)

    Gets the per-app index with the specified name or creates a new one, if necessary.

    public static ContentIndexer GetIndexer(String indexName)public static ContentIndexer GetIndexer(String indexName)Public Static Function GetIndexer(indexName As String) As ContentIndexerpublic static ContentIndexer GetIndexer(String indexName)

    Parameters

    • indexName
      System.String
      System.String
      System.String
      System.String

      The index name.

    Returns

    Remarks

    The app can provide an indexName identifier that it can use to partition data for its own queries. This identifier is included as part of the item scope, which means that it's faster to partition based on this scope than by filtering with a property. The approach has the cost of being unable to query easily across multiple scopes.

  • RetrievePropertiesAsync(String, IIterable<String>)
    RetrievePropertiesAsync(String, IIterable<String>)
    RetrievePropertiesAsync(String, IIterable<String>)
    RetrievePropertiesAsync(String, IIterable<String>)

    Gets content properties based on the given content identifier.

    public IAsyncOperation<IMapView<string, object>> RetrievePropertiesAsync(String contentId, IIterable<String> propertiesToRetrieve)public IAsyncOperation<IMapView<string, object>> RetrievePropertiesAsync(String contentId, IIterable<String> propertiesToRetrieve)Public Function RetrievePropertiesAsync(contentId As String, propertiesToRetrieve As IIterable<String>) As IAsyncOperation( Of IMapViewstring, object )public IAsyncOperation<IMapView<string, object>> RetrievePropertiesAsync(String contentId, IIterable<String> propertiesToRetrieve)

    Parameters

    • contentId
      System.String
      System.String
      System.String
      System.String

      The identifier for the content properties.

    • propertiesToRetrieve

      The retrieved properties, based on contentId.

    Returns

    • When this method completes, it returns the retrieved properties as a map of key-value pairs.

  • UpdateAsync(IIndexableContent)
    UpdateAsync(IIndexableContent)
    UpdateAsync(IIndexableContent)
    UpdateAsync(IIndexableContent)

    Updates app content and properties in the ContentIndexer.

    public IAsyncAction UpdateAsync(IIndexableContent indexableContent)public IAsyncAction UpdateAsync(IIndexableContent indexableContent)Public Function UpdateAsync(indexableContent As IIndexableContent) As IAsyncActionpublic IAsyncAction UpdateAsync(IIndexableContent indexableContent)

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.Storage.Search.dll