要素に対してこのプロパティを設定することは、要素のコンテンツが指定された MIME の種類/コンテンツタイプの base64 エンコードとして扱われ、そのコンテンツタイプのハンドラーを使用してインデックスが作成されることを示します。
<element
sc:ContentType= "application/hta" | "application/mac-binhex40" | "application/vnd.ms-xpsdocument"
| "application/windows-appcontent+xml" | "application/x-compress" | "application/x-compressed"
| "application/x-gzip" | "application/x-jtx+xps" | "application/x-latex"
| "application/x-mplayer2" | "application/x-ms-wmz" | "application/x-stuffit"
| "application/x-tar" | "application/x-wmplayer" | "application/x-zip-compressed"
| "application/xml" | "audio/aiff" | "audio/basic" | "audio/mid" | "audio/midi"
| "audio/mp3" | "audio/mpeg" | "audio/mpegurl" | "audio/mpg" | "audio/wav"
| "audio/x-aiff" | "audio/x-mid" | "audio/x-midi" | "audio/x-mp3"
| "audio/x-mpeg" | "audio/x-mpegurl" | "audio/x-mpg" | "audio/x-ms-wax"
| "audio/x-ms-wma" | "audio/x-wav" | "image/bmp" | image/gif"
| "image/jpeg" | "image/pjpeg" | "image/png" | "image/vnd.ms-photo"
| "image/x-emf" | "image/x-icon" | "image/x-png" | "image/x-wmf"
| "midi/mid" | "model/vnd.dwfx+xps" | "model/vnd.easmx+xps"
| "model/vnd.edrwx+xps" | "model/vnd.eprtx+xps" | "pkcs7-mime"
| "text/css" | "text/html" | "text/plain" | "text/xml"
| "video/avi" | "video/mpeg" | "video/mpg" | "video/msvideo"
| "video/quicktime" | "video/x-mpeg" | "video/x-mpeg2a"
| "video/x-ms-asf" | "video/x-ms-asf-plugin" | "video/x-ms-wm"
| "video/x-ms-wmv" | "video/x-ms-wmx" | "video/x-ms-wvx"
| "video/x-msvideo"
xmlns:sc="http://schemas.microsoft.com/Search/2013/ApplicationContent">
</element>
データ型
この属性は、次のいずれかの値を受け取ります。
application/htaapplication/mac-binhex40application/vnd.ms-xpsdocumentapplication/windows-appcontent+xmlapplication/x-compressapplication/x-compressedapplication/x-gzipapplication/x-jtx+xpsapplication/x-latexapplication/x-mplayer2application/x-ms-wmzapplication/x-stuffitapplication/x-tarapplication/x-wmplayerapplication/x-zip-compressedapplication/xmlaudio/aiffaudio/basicaudio/midaudio/midiaudio/mp3audio/mpegaudio/mpegurlaudio/mpgaudio/wavaudio/x-aiffaudio/x-midaudio/x-midiaudio/x-mp3audio/x-mpegaudio/x-mpegurlaudio/x-mpgaudio/x-ms-waxaudio/x-ms-wmaaudio/x-wavimage/bmpimage/gifimage/jpegimage/pjpegimage/pngimage/vnd.ms-photoimage/x-emfimage/x-iconimage/x-pngimage/x-wmfmidi/midmodel/vnd.dwfx+xpsmodel/vnd.easmx+xpsmodel/vnd.edrwx+xpsmodel/vnd.eprtx+xpspkcs7-mimetext/csstext/htmltext/plaintext/xmlvideo/avivideo/mpegvideo/mpgvideo/msvideovideo/quicktimevideo/x-mpegvideo/x-mpeg2avideo/x-ms-asfvideo/x-ms-asf-pluginvideo/x-ms-wmvideo/x-ms-wmvvideo/x-ms-wmxvideo/x-ms-wvxvideo/x-msvideo
例
この例では、"Sample 1" という名前の項目を記述する単純な appcontent-ms ファイルを示します。
ファイルには、appcontent-ms スキーマ IndexerSampleInformation で定義されていない要素 (および IndexerSampleSpecificElement ) が含まれていることに注意してください。 Appcontent-ms ファイルには、インデックスを作成するすべてのデータをカプセル化するルートノードが必要ですが、そのノードには任意の名前を付けることができます。
<?xml version="1.0" encoding="utf-8"?>
<IndexerSampleInformation>
<Properties xmlns="http://schemas.microsoft.com/Search/2013/ApplicationContent">
<Name>Sample 1</Name>
<Keywords>
<Keyword xml:lang="en-US">Sample 1 - keyword 1</Keyword>
<Keyword>Sample 1 - keyword 2</Keyword>
</Keywords>
<Comment>Sample 1 comment</Comment>
<AdditionalProperties>
<Property Key="System.Title">Sample 1 Title</Property>
<Property xml:lang="en-US" Key="System.Contact.EmailAddresses">
<Value>bryan@contoso.com</Value>
<Value>vincent@contoso.com</Value>
</Property>
</AdditionalProperties>
</Properties>
<IndexerSampleSpecificElement sc:IndexableContent="true"
xmlns:sc="http://schemas.microsoft.com/Search/2013/ApplicationContent">
The text included here will be indexed, enabling full-text search.
</IndexerSampleSpecificElement>
</IndexerSampleInformation>
任意の要素のコンテンツにインデックスを作成するように Windows 検索を指定することもできます。 Indexablecontent属性を使用して、コンテンツのインデックスを検索するように指示します。 前の例では、 indexablecontent属性がtrueに設定されているため、Windows Search は IndexerSampleSpecificElement の内容のインデックスを作成します。
<IndexerSampleSpecificElement sc:IndexableContent="true"
xmlns:sc="http://schemas.microsoft.com/Search/2013/ApplicationContent">
The text included here will be indexed, enabling full-text search.
</IndexerSampleSpecificElement>
既定では、検索でコンテンツがテキストコンテンツとして扱われます。コンテンツが base64 の場合は、 ContentType 属性を使用して MIME の種類を指定します。
次の例では、アプリの LocalFolder\Indexed フォルダーに appcontent-ms ファイルをコピーする方法を示します。 このコードは、アプリの appcontent-ms フォルダーで見つかったすべてのファイルを LocalFolder\Indexed フォルダーにコピーします。 (別の場所からコピーするのではなく、新しい appcontent-ms ファイルをインデックス付きフォルダーに直接作成することもできます)。
/// <summary>
/// For the purposes of this sample, the appcontent-ms files are stored in an "appcontent-ms" folder in the
/// install directory. These are then copied into the app's "LocalState\Indexed" folder, which exposes them
/// to the indexer.
/// </summary>
public async static Task<string> AddAppContentFilesToIndexedFolder()
{
var localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
var installDirectory = Windows.ApplicationModel.Package.Current.InstalledLocation;
var outputString = "Items added to the \"Indexed\" folder:";
var appContentFolder = await installDirectory.GetFolderAsync("appcontent-ms");
var indexedFolder = await localFolder.CreateFolderAsync(
"Indexed", Windows.Storage.CreationCollisionOption.OpenIfExists);
var files = await appContentFolder.GetFilesAsync();
foreach (var file in files)
{
outputString += "\n" + file.DisplayName + file.FileType;
await file.CopyAsync(indexedFolder,
file.Name, Windows.Storage.NameCollisionOption.ReplaceExisting);
}
return outputString;
}
// For the purposes of this sample, the appcontent-ms files are stored in an "appcontent-ms" folder
// in the install directory. These are then copied into the app's "LocalState\Indexed" folder,
// which exposes them to the indexer.
function _addAppContentFilesToIndexedFolder() {
var localFolder = appData.localFolder,
appcontentFolder,
indexedFolder,
installDirectory = Windows.ApplicationModel.Package.current.installedLocation;
var output = "Items added to the \"Indexed\" folder:\n";
installDirectory.getFolderAsync("appcontent-ms").then(function (retrievedAppcontentFolder) {
appcontentFolder = retrievedAppcontentFolder;
return localFolder.createFolderAsync(
"Indexed", Windows.Storage.CreationCollisionOption.openIfExists);
}).then(function (retrievedIndexedFolder) {
indexedFolder = retrievedIndexedFolder;
return appcontentFolder.getFilesAsync(appcontentFolder);
}).then(function (files) {
var promiseArray = [];
for (var i = 0, len = files.length; i < len; i++) {
promiseArray[i] = files[i].copyAsync(indexedFolder,
files[i].name, Windows.Storage.NameCollisionOption.replaceExisting);
output += files[i].displayName + files[i].fileType;
if (i < len - 1) {
output += "\n";
}
}
return WinJS.Promise.join(promiseArray);
}).done(function () {
WinJS.log && WinJS.log(output, "sample", "status");
});
}
完全なコードについては、「 インデクサーのサンプル」を参照してください。
要件
サポートされている最小のクライアント |
Windows 8.1 [デスクトップアプリのみ] |
サポートされている最小のサーバー |
Windows Server 2012 R2 [デスクトップアプリのみ] |
関連項目