Comentário

Contém um System.Comment que descreve o item.

Hierarquia de elementos

<Propriedades>
<Comentário>

Syntax

<Comment>

  string

</Comment>

Atributos e elementos

Atributos

Nenhum.

Elementos filho

Nenhum.

Elementos pai

Elemento pai Descrição
Propriedades

Contém propriedades que descrevem o item para o índice Windows Search.

 

Exemplos

Este exemplo mostra um arquivo appcontent-ms simples que descreve um item chamado "Exemplo 1".

Observe que o arquivo contém elementos não definidos pelo esquema appcontent-ms: IndexerSampleInformation e IndexerSampleSpecificElement. Seu arquivo appcontent-ms deve ter um nó raiz que encapsula todos os dados a serem indexados, mas você pode nomear esse nó como quiser.

<?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>

Você pode até mesmo Windows Search para indexar o conteúdo de elementos arbitrários. Basta usar o atributo IndexableContent para dizer à Pesquisa para indexar o conteúdo. No exemplo anterior, Windows Search indexará o conteúdo do IndexerSampleSpecificElement porque o atributo IndexableContent está definido como true:

  <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>

A pesquisa tratará o conteúdo como conteúdo de texto por padrão; se o conteúdo for base64, use o atributo ContentType para especificar o tipo MIME.

O exemplo a seguir mostra como copiar um arquivo appcontent-ms para a pasta LocalFolder\Indexed do aplicativo. O código copia todos os arquivos encontrados na pasta appcontent-ms do aplicativo para a pasta LocalFolder\Indexed. (Você também pode criar novos arquivos appcontent-ms diretamente na pasta Indexado em vez de copiá-los de outro local.)

/// <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&#39;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&#39;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 &amp;&amp; WinJS.log(output, "sample", "status");
    });
}

Para ver o código completo, consulte o exemplo indexador.

Confira também

Exemplo de indexador

Windows. Armazenamento. Busca

Requisitos

Valor
Namespace http://schemas.microsoft.com/Search/2013/ApplicationContent