ContentType

요소에서 이 속성을 설정하면 요소의 콘텐츠가 지정된 MIME 형식/콘텐츠 형식의 base64 인코딩으로 처리되고 해당 콘텐츠 형식에 대한 처리기를 사용하여 인덱싱됨을 나타냅니다.

<element
    sc:ContentType= "application/hta" | "application/mac-binhex40" | "application/vnd.ms-xpsdocument"
        | "application/windows-appcontent+xml" | "application/x-compress" | "application/x-compressed" 
        | "application/x-gzip" | "application/x-jtx+xps" | "application/x-latex"
        | "application/x-mplayer2" | "application/x-ms-wmz" | "application/x-stuffit"
        | "application/x-tar" | "application/x-wmplayer" | "application/x-zip-compressed"
        | "application/xml" | "audio/aiff" | "audio/basic" | "audio/mid" | "audio/midi"
        | "audio/mp3" | "audio/mpeg" | "audio/mpegurl" | "audio/mpg" | "audio/wav"
        | "audio/x-aiff" | "audio/x-mid" | "audio/x-midi" | "audio/x-mp3" 
        | "audio/x-mpeg" | "audio/x-mpegurl" | "audio/x-mpg" | "audio/x-ms-wax" 
        | "audio/x-ms-wma" | "audio/x-wav" | "image/bmp" | image/gif" 
        | "image/jpeg" | "image/pjpeg" | "image/png" | "image/vnd.ms-photo"
        | "image/x-emf" | "image/x-icon" | "image/x-png" | "image/x-wmf"
        | "midi/mid" | "model/vnd.dwfx+xps" | "model/vnd.easmx+xps" 
        | "model/vnd.edrwx+xps" | "model/vnd.eprtx+xps" | "pkcs7-mime"
        | "text/css" | "text/html" | "text/plain" | "text/xml"
        | "video/avi" | "video/mpeg" | "video/mpg" | "video/msvideo" 
        | "video/quicktime" | "video/x-mpeg" | "video/x-mpeg2a" 
        | "video/x-ms-asf" | "video/x-ms-asf-plugin" | "video/x-ms-wm"
        | "video/x-ms-wmv" | "video/x-ms-wmx" | "video/x-ms-wvx"
        | "video/x-msvideo"
        xmlns:sc="http://schemas.microsoft.com/Search/2013/ApplicationContent">
</element>

데이터 형식

이 특성은 다음 값 중 하나를 허용합니다.

  • application/hta
  • application/mac-binhex40
  • application/vnd.ms-xpsdocument
  • application/windows-appcontent+xml
  • application/x-compress
  • application/x-compressed
  • application/x-gzip
  • application/x-jtx+xps
  • application/x-latex
  • application/x-mplayer2
  • application/x-ms-wmz
  • application/x-stuffit
  • application/x-tar
  • application/x-wmplayer
  • application/x-zip-compressed
  • application/xml
  • audio/aiff
  • audio/basic
  • audio/mid
  • audio/midi
  • audio/mp3
  • audio/mpeg
  • audio/mpegurl
  • audio/mpg
  • audio/wav
  • audio/x-aiff
  • audio/x-mid
  • audio/x-midi
  • audio/x-mp3
  • audio/x-mpeg
  • audio/x-mpegurl
  • audio/x-mpg
  • audio/x-ms-wax
  • audio/x-ms-wma
  • audio/x-wav
  • image/bmp
  • image/gif
  • image/jpeg
  • image/pjpeg
  • image/png
  • image/vnd.ms-photo
  • image/x-emf
  • image/x-icon
  • image/x-png
  • image/x-wmf
  • midi/mid
  • model/vnd.dwfx+xps
  • model/vnd.easmx+xps
  • model/vnd.edrwx+xps
  • model/vnd.eprtx+xps
  • pkcs7-mime
  • text/css
  • text/html
  • text/plain
  • text/xml
  • video/avi
  • video/mpeg
  • video/mpg
  • video/msvideo
  • video/quicktime
  • video/x-mpeg
  • video/x-mpeg2a
  • video/x-ms-asf
  • video/x-ms-asf-plugin
  • video/x-ms-wm
  • video/x-ms-wmv
  • video/x-ms-wmx
  • video/x-ms-wvx
  • video/x-msvideo

이 예제에서는 "샘플 1"이라는 항목을 설명하는 간단한 appcontent-ms 파일을 보여 줍니다.

파일에 appcontent-ms 스키마 IndexerSampleInformation 로 정의되지 않은 요소 및 IndexerSampleSpecificElement. appcontent-ms 파일에는 인덱싱할 모든 데이터를 캡슐화하는 루트 노드가 있어야 하지만 원하는 모든 노드의 이름을 지정할 수 있습니다.

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

Windows Search에 임의의 요소의 콘텐츠를 인덱싱하도록 지시할 수도 있습니다. IndexableContent 특성을 사용하여 Search에 콘텐츠를 인덱싱하도록 지시하기만 하면됩니다. 앞의 예제에서 Windows Search는 IndexableContent 특성이 true로 설정되어 있으므로 IndexerSampleSpecificElement의 콘텐츠를 인덱싱합니다.

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

검색은 기본적으로 콘텐츠를 텍스트 콘텐츠로 처리합니다. 콘텐츠가 base64이면 ContentType 특성을 사용하여 MIME 형식을 지정합니다.

다음 예제에서는 appcontent-ms 파일을 앱의 LocalFolder\Indexed 폴더에 복사하는 방법을 보여줍니다. 코드는 앱의 appcontent-ms 폴더에서 찾은 모든 파일을 LocalFolder\Indexed 폴더에 복사합니다. (다른 위치에서 복사하는 대신 인덱싱된 폴더에 직접 새 appcontent-ms 파일을 만들 수도 있습니다.)

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

전체 코드는 인덱서 샘플을 참조하세요.

요구 사항

지원되는 최소 클라이언트

Windows 8.1 [데스크톱 앱만 해당]

지원되는 최소 서버

R2 Windows Server 2012 [데스크톱 앱만 해당]

참고 항목

인덱서 샘플

Windows. Storage. 검색