Freigeben über


Eigenschaften (App-Inhaltsschema)

Enthält Eigenschaften, die das Element für den suchindex Windows beschreiben.

Elementhierarchie

<Eigenschaften>

Syntax

<Properties>

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

</Properties>

Schlüssel

? optional (null oder eins)

& Verwebungsconnector (kann in beliebiger Reihenfolge auftreten)

Attribute und Elemente

Attribute

Keine

Untergeordnete Elemente

Untergeordnetes Element BESCHREIBUNG
AdditionalProperties

Enthält zusätzliche Eigenschaften, die das Element beschreiben.

Comment

Enthält einen System.Comment, der das Element beschreibt.

Schlüsselwörter

Enthält die System.Keywords, die das Element beschreiben.

Name

Gibt das System.ItemNameSystem.ItemNameDisplay \ des Elements an.

 

Übergeordnete Elemente

Dieses äußerste Element (Dokument) darf nicht in anderen Elementen enthalten sein.

Beispiele

Dieses Beispiel zeigt eine einfache Appcontent-ms-Datei, die ein Element mit dem Namen "Sample 1" beschreibt.

Beachten Sie, dass die Datei Elemente enthält, die nicht durch das appcontent-ms-Schema definiert sind: IndexerSampleInformation und IndexerSampleSpecificElement. Ihre Datei appcontent-ms muss über einen Stammknoten verfügen, der alle zu indizierenden Daten kapselt. Sie können diesen Knoten jedoch nach Bennen benennen.

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

Sie können sogar Windows Search anraten, den Inhalt beliebiger Elemente zu indizieren. Verwenden Sie einfach das IndexableContent-Attribut , um Search an soll, den Inhalt zu indizieren. Im vorherigen Beispiel indiziert Windows Search den Inhalt des IndexerSampleSpecificElement, da das IndexableContent-Attribut auf TRUE festgelegt ist:

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

Die Suche behandelt den Inhalt standardmäßig als Textinhalt. Wenn der Inhalt base64 ist, verwenden Sie das ContentType-Attribut , um den MIME-Typ anzugeben.

Das nächste Beispiel zeigt, wie Sie eine Appcontent-ms-Datei in den Ordner LocalFolder\Indexed Ihrer App kopieren. Der Code kopiert alle Dateien, die er im Ordner appcontent-ms der App findet, in den Ordner LocalFolder\Indexed. (Sie können auch neue appcontent-ms-Dateien direkt im Indizierten Ordner erstellen, anstatt sie von einem anderen Speicherort zu kopieren.)

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

Den vollständigen Code finden Sie im Indexer-Beispiel.

Siehe auch

Indexer-Beispiel

Windows. Storage. Suche

Anforderungen

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