IndexableContent

Indica que o texto do elemento deve ser indexado para pesquisa, mas não está associado a uma propriedade. Observe que as propriedades podem ser recuperadas posteriormente com base na chave de propriedade, mas o conteúdo de texto não pode.

<element
    sc:IndexableContent= "true" | "false" | "1" | "0"
    xmlns:sc="http://schemas.microsoft.com/Search/2013/ApplicationContent">
</element>

Tipo de dados

Este atributo aceita valores Boolianos:

  • true
  • false
  • 1
  • 0

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.

Requisitos

Cliente mínimo com suporte

Windows 8.1 [somente aplicativos da área de trabalho]

Servidor mínimo com suporte

Windows Server 2012 R2 [somente aplicativos da área de trabalho]

Confira também

Exemplo de indexador

Windows. Armazenamento. Procurando