Share via


ContentIndexer 類別

定義

讓 UWP app 能夠使用系統索引讓私人內容可供搜尋。

public ref class ContentIndexer sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ContentIndexer final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ContentIndexer
Public NotInheritable Class ContentIndexer
繼承
Object Platform::Object IInspectable ContentIndexer
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

內容索引器範例 (Windows 10)

示範應用程式的影片逐步解說

備註

ContentIndexer 類別可讓應用程式將屬性包推送至系統索引,稍後可由應用程式或使用者快速搜尋。 屬性包可以包含殼層屬性系統中的任何屬性,而且可在 API 呼叫傳回之後立即搜尋。

這些屬性會定義為字串物件索引鍵/值組,其中索引鍵是標準 Windows 屬性名稱,例如 System.Author,而值是 PropertyValue 實例。 屬性必須在系統上註冊,且 isColumn 且 isInvertedIndex 設定為 true。 您也可以使用資料流程和內容類型來提供全文檢索搜尋內容。 這會對應至執行型別的 IFilter 實作,並編制內容的索引。

您可以使用進階查詢語法 (AQS) 來查詢內容。

請勿使用索引作為主要資料存放區,索引只是可搜尋屬性的快取。 索引中的所有資料都必須儲存在其他地方,以防快取遺失。 每個應用程式套件和每個使用者的內容會分開。 套件無法查詢另一個套件的資料,但作業系統可以存取任何推送的資料。

如需可用之屬性的詳細資訊,請參閱 Windows 屬性系統

屬性

Revision

取得 ContentIndexer的版本。

方法

AddAsync(IIndexableContent)

將具有屬性和內容的應用程式定義專案新增至系統索引。

CreateQuery(String, IIterable<String>)

使用指定的搜尋篩選來建置查詢,並識別要擷取的屬性。

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

使用指定的搜尋篩選、排序次序,建置查詢,並識別要擷取的屬性。

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

使用指定的搜尋篩選、排序次序、篩選語言,建置查詢,並識別要擷取的屬性。

DeleteAllAsync()

ContentIndexer移除所有應用程式定義的專案。

DeleteAsync(String)

ContentIndexer移除指定的應用程式定義專案。

DeleteMultipleAsync(IIterable<String>)

ContentIndexer移除指定的應用程式定義專案。

GetIndexer()

視需要取得現有的個別應用程式索引或建立新的索引。

GetIndexer(String)

視需要取得具有指定名稱或建立新名稱的個別應用程式索引。

RetrievePropertiesAsync(String, IIterable<String>)

根據指定的內容識別碼取得內容屬性。

UpdateAsync(IIndexableContent)

更新ContentIndexer中的應用程式內容和屬性。

適用於

另請參閱