Proprietà (schema del contenuto dell'app)

Contiene proprietà che descrivono l'elemento nell'Windows di ricerca.

Gerarchia degli elementi

<Proprietà>

Sintassi

<Properties>

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

</Properties>

Chiave

? facoltativo (zero o uno)

& connettore interleave (può verificarsi in qualsiasi ordine)

Attributi ed elementi

Attributi

Nessuno.

Elementi figlio

Elemento figlio Descrizione
AdditionalProperties

Contiene proprietà aggiuntive che descrivono l'elemento.

Commento

Contiene un oggetto System.Comment che descrive l'elemento.

Parole chiave

Contiene system.Keywords che descrivono l'elemento.

Nome

Specifica l'oggetto System.ItemNameSystem.ItemNameDisplay \dell'elemento.

 

Elementi padre

Questo elemento più esterno (documento) potrebbe non essere contenuto da altri elementi.

Esempio

Questo esempio mostra un semplice file appcontent-ms che descrive un elemento denominato "Sample 1".

Si noti che il file contiene elementi non definiti dallo schema appcontent-ms: IndexerSampleInformation e IndexerSampleSpecificElement. Il file appcontent-ms deve avere un nodo radice che incapsula tutti i dati da indicizzare, ma è possibile assegnare qualsiasi nome al nodo desiderato.

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

È anche possibile indicare Windows ricerca per indicizzare il contenuto di elementi arbitrari. È sufficiente usare l'attributo IndexableContent per indicare a Search di indicizzare il contenuto. Nell'esempio precedente, Windows indicizza il contenuto di IndexerSampleSpecificElement perché l'attributo IndexableContent è impostato su 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>

La ricerca considera il contenuto come contenuto di testo per impostazione predefinita. Se il contenuto è base64, usare l'attributo ContentType per specificare il tipo MIME.

L'esempio seguente illustra come copiare un file appcontent-ms nella cartella LocalFolder\Indexed dell'app. Il codice copia tutti i file trovati nella cartella appcontent-ms dell'app nella cartella LocalFolder\Indexed. È anche possibile creare nuovi file appcontent-ms direttamente nella cartella Indicizzato anziché copiarli da un altro percorso.

/// <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");
    });
}

Per il codice completo, vedere l'esempio di indicizzatore.

Vedi anche

Esempio di indicizzatore

Windows. Archiviazione. Ricerca

Requisiti

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