Content​Indexer Content​Indexer Content​Indexer Class

Definition

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

public : sealed class ContentIndexer : IContentIndexer, IContentIndexerQueryOperationspublic sealed class ContentIndexer : IContentIndexer, IContentIndexerQueryOperationsPublic NotInheritable Class ContentIndexer Implements IContentIndexer, IContentIndexerQueryOperations
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 and have isColumn and isInvertedIndex set to true.

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

Revision Revision Revision

Gets the version of the ContentIndexer.

public : ulong Revision { get; }public ulong Revision { get; }Public ReadOnly Property Revision As ulong
Value
ulong ulong ulong

The revision number.

Attributes

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.

See Also

Methods

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 IAsyncAction
Parameters
indexableContent
IIndexableContent IIndexableContent IIndexableContent

The content properties to index.

Returns
Attributes
See Also

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(PlatForm::String searchFilter, IIterable<PlatForm::String> propertiesToRetrieve)public ContentIndexerQuery CreateQuery(String searchFilter, IEnumerable<String> propertiesToRetrieve)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IEnumerable<String>) As ContentIndexerQuery
Parameters
searchFilter
PlatForm::String String String

The Advanced Query Syntax (AQS) filter to apply.

propertiesToRetrieve
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

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

Returns
Attributes

Remarks

Call the GetPropertiesAsync method to run the query.

See Also

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(PlatForm::String searchFilter, IIterable<PlatForm::String> propertiesToRetrieve, IIterable<SortEntry> sortOrder)public ContentIndexerQuery CreateQuery(String searchFilter, IEnumerable<String> propertiesToRetrieve, IEnumerable<SortEntry> sortOrder)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IEnumerable<String>, sortOrder As IEnumerable<SortEntry>) As ContentIndexerQuery
Parameters
searchFilter
PlatForm::String String String

The Advanced Query Syntax (AQS) filter.

propertiesToRetrieve
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

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

sortOrder
IIterable<SortEntry> IEnumerable<SortEntry> IEnumerable<SortEntry>

The sort order for the filtered results.

Returns
Attributes
See Also

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(PlatForm::String searchFilter, IIterable<PlatForm::String> propertiesToRetrieve, IIterable<SortEntry> sortOrder, PlatForm::String searchFilterLanguage)public ContentIndexerQuery CreateQuery(String searchFilter, IEnumerable<String> propertiesToRetrieve, IEnumerable<SortEntry> sortOrder, String searchFilterLanguage)Public Function CreateQuery(searchFilter As String, propertiesToRetrieve As IEnumerable<String>, sortOrder As IEnumerable<SortEntry>, searchFilterLanguage As String) As ContentIndexerQuery
Parameters
searchFilter
PlatForm::String String String

The Advanced Query Syntax (AQS) filter to apply.

propertiesToRetrieve
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

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

sortOrder
IIterable<SortEntry> IEnumerable<SortEntry> IEnumerable<SortEntry>

The sort order for the filtered results.

searchFilterLanguage
PlatForm::String String String

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

Returns
Attributes
See Also

DeleteAllAsync() DeleteAllAsync() DeleteAllAsync()

Removes all app-defined items from the ContentIndexer.

public : IAsyncAction DeleteAllAsync()public IAsyncAction DeleteAllAsync()Public Function DeleteAllAsync() As IAsyncAction
Returns
Attributes
See Also

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

Removes the specified app-defined item from the ContentIndexer.

public : IAsyncAction DeleteAsync(PlatForm::String contentId)public IAsyncAction DeleteAsync(String contentId)Public Function DeleteAsync(contentId As String) As IAsyncAction
Parameters
contentId
PlatForm::String String String

The identifier of the item to remove.

Returns
Attributes
See Also

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

Removes the specified app-defined items from the ContentIndexer.

public : IAsyncAction DeleteMultipleAsync(IIterable<PlatForm::String> contentIds)public IAsyncAction DeleteMultipleAsync(IEnumerable<String> contentIds)Public Function DeleteMultipleAsync(contentIds As IEnumerable<String>) As IAsyncAction
Parameters
contentIds
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

The identifier of the item to remove.

Returns
Attributes

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 ContentIndexer
Returns
Attributes
See Also

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(PlatForm::String indexName)public static ContentIndexer GetIndexer(String indexName)Public Static Function GetIndexer(indexName As String) As ContentIndexer
Parameters
indexName
PlatForm::String String String

The index name.

Returns
Attributes

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.

See Also

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

Gets content properties based on the given content identifier.

public : IAsyncOperation<IMapView<PlatForm::String, PlatForm::Object>> RetrievePropertiesAsync(PlatForm::String contentId, IIterable<PlatForm::String> propertiesToRetrieve)public IAsyncOperation<IReadOnlyDictionary<string, object>> RetrievePropertiesAsync(String contentId, IEnumerable<String> propertiesToRetrieve)Public Function RetrievePropertiesAsync(contentId As String, propertiesToRetrieve As IEnumerable<String>) As IAsyncOperation( Of IReadOnlyDictionarystring, object )
Parameters
contentId
PlatForm::String String String

The identifier for the content properties.

propertiesToRetrieve
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

The retrieved properties, based on contentId.

Returns
IAsyncOperation<IMapView<PlatForm::String, PlatForm::Object>> IAsyncOperation<IReadOnlyDictionary<string, object>> IAsyncOperation<IReadOnlyDictionary<string, object>>

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

Attributes

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 IAsyncAction
Parameters
indexableContent
IIndexableContent IIndexableContent IIndexableContent

The content properties to update.

Returns
Attributes
See Also

See Also