Propriedades (esquema de conteúdo do aplicativo)

contém propriedades que descrevem o item para o índice de pesquisa de Windows.

Hierarquia de elementos

<Properties>

Syntax

<Properties>

  <!-- Child elements -->
  ( Name
  & Keywords?
  & Comment?
  & AdditionalProperties?
  )

</Properties>

Chave

? opcional (zero ou um)

& conector de intercalação (pode ocorrer em qualquer ordem)

Atributos e elementos

Atributos

Nenhum.

Elementos filho

Elemento filho Descrição
AdditionalProperties

Contém propriedades adicionais que descrevem o item.

Comentário

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

Palavras-chave

Contém as palavras-chave System. keyque descrevem o item.

Nome

Especifica o System . ItemName \System. ItemNameDisplay do item.

 

Elementos pai

Esse elemento mais externo (documento) pode não estar contido em outros elementos.

Exemplos

Este exemplo mostra um arquivo appcontent-MS simples que descreve um item chamado "Sample 1".

Observe que o arquivo contém elementos não definidos pelo esquema appcontent-MS: IndexerSampleInformation e IndexerSampleSpecificElement . O arquivo appcontent-MS deve ter um nó raiz que encapsula todos os dados a serem indexados, mas você pode nomeá-lo como desejar.

<?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 dizer Windows pesquisa para indexar o conteúdo de elementos arbitrários. Basta usar o atributo IndexableContent para informar à pesquisa para indexar o conteúdo. no exemplo anterior, Windows pesquisa 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 seu 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 indexada 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 obter o código completo, consulte o exemplo do indexador.

Confira também

Exemplo de indexador

Windows. Armazenamento. Procurando

Requisitos

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