■ Spotlightで属性(メタデータ)を利用する
Spotlightの検索は、ファイルに埋め込まれた属性情報も活用しています。(だから、ファイルの種類や日付を制限して検索する事が可能です!)
Spotlightでは、Part1で紹介した「kind」や「date」以外の、様々な属性情報から検索結果を絞り込む事ができます。
例えば、Mac OS X 10.5 Help「Spotlight 検索フィールドで条件を指定する」に、
デジタル写真を撮影すると、カメラの機種、絞り、焦点距離などの情報が、多くの属性と共にファイルにメタデータとして自動的に保存されます。という記述があります。このヘルプ内では軽くスルーされてしまいましたが、「カメラの機種」は「model:〜」、「絞り」は「aperture:〜」、「焦点距離」は「focallength:〜」として検索条件を記述する事ができます。
このように、属性(メタデータ)を活用すると、かなりきめ細かく検索する事できます。
ちなみに、Mac OS Xで利用可能な属性は、「MDItem.h」に定義されています。この中で、ファイルの「種類」は「kMDItemKind」と定義されています。実は、Spotlightの検索フィールドで「kMDItemKind:〜」と記述する事も可能です。このままでは冗長なせいか、エイリアス「kind」が設定されているようです。
残念ながら、Mac OS Xで定義されている「属性」と「エイリアス」の関係がまとめられた情報がほとんど見つかりませんでした。という訳で、勝手に一覧表にしてみました。一応、Webの情報や実機での調査をベースにしています。が、基本は想像レベルなので、足りないところ、間違っているところなど多くあると思います。もし見つけたらツッコミお願いします!
一覧表の「属性名」、「エイリアス」は、どれもSpotlightの検索条件として記述する事ができます。「データ型」は、デリミタ「:」以降に記述する事ができる「型」です。「数値」の場合は、「:」の後に「>」「<」などの演算子が利用可能です。「日付」の場合は、「>」「<」などに加えて、「-」で範囲指定する事が可能です。ただし、"this week"などの特殊なキーワードは利用できません。(date:〜限定のようです)「Boolean」の場合は、「0」か「1」になります。
| 属性名 | エイリアス | データ型 | |
|---|---|---|---|
| kMDItemAttributeChangeDate | 日付 | ||
| kMDItemContentType | 文字列 | ||
| kMDItemContentTypeTree | 文字列 | ||
| kMDItemKeywords | keyword | 文字列 | |
| kMDItemTitle | title | 文字列 | |
| kMDItemAuthors | author from, with, by | 文字列 | |
| kMDItemEditors | editor | 文字列 | * |
| kMDItemProjects | project | 文字列 | * |
| kMDItemWhereFroms | wherefrom | 文字列 | |
| kMDItemComment | comment | 文字列 | |
| kMDItemCopyright | copyright | 文字列 | |
| kMDItemLastUsedDate | lastused used, date | 日付 | |
| kMDItemContentCreationDate | contentcreated created, date | 日付 | |
| kMDItemContentModificationDate | contentmodified modified, date | 日付 | |
| kMDItemDurationSeconds | duration time | 数値 ※秒 | |
| kMDItemContactKeywords | contactkeyword keyword | 文字列 | |
| kMDItemVersion | version | 文字列 | |
| kMDItemPixelHeight | pixelheight height | 数値 | |
| kMDItemPixelWidth | pixelwidth width | 数値 | |
| kMDItemColorSpace | colorspace | 文字列 | |
| kMDItemBitsPerSample | bitspersample bps | 数値 | |
| kMDItemFlashOnOff | flash | Boolean | |
| kMDItemFocalLength | focallength | 数値 | |
| kMDItemAcquisitionMake | make | 文字列 | |
| kMDItemAcquisitionModel | model | 文字列 | |
| kMDItemISOSpeed | ISO | 数値 ※大文字 | |
| kMDItemOrientation | orientation | 数値 | |
| kMDItemLayerNames | layer | 文字列 | |
| kMDItemWhiteBalance | whitebalance | 文字列 | |
| kMDItemAperture | aperture fstop | 数値 | |
| kMDItemProfileName | profile | 文字列 | |
| kMDItemResolutionWidthDPI | widthdpi | 数値 | |
| kMDItemResolutionHeightDPI | heightdpi | 数値 | |
| kMDItemExposureMode | exposuremode | 数値 | |
| kMDItemExposureTimeSeconds | exposuretime | 数値 | |
| kMDItemEXIFVersion | exifversion | 文字列 | |
| kMDItemEXIFGPSVersion | 文字列 | * | |
| kMDItemAltitude | altitude | 数値 | * |
| kMDItemLatitude | latitude | 数値 | * |
| kMDItemLongitude | longitude | 数値 | * |
| kMDItemSpeed | 数値 | * | |
| kMDItemTimestamp | 日付 | * | |
| kMDItemGPSTrack | 数値 | * | |
| kMDItemImageDirection | 数値 | * | |
| kMDItemCodecs | codec | 文字列 | |
| kMDItemMediaTypes | mediatype | 文字列 | |
| kMDItemStreamable | streamable | Boolean | |
| kMDItemTotalBitRate | totalbitrate bitrate | 数値 | |
| kMDItemVideoBitRate | videobitrate bitrate | 数値 | |
| kMDItemAudioBitRate | audiobitrate bitrate | 数値 | |
| kMDItemDeliveryType | delivery | 文字列 | * |
| kMDItemAlbum | album title | 文字列 | |
| kMDItemHasAlphaChannel | alpha | 数値 | |
| kMDItemRedEyeOnOff | redeye | Boolean | |
| kMDItemMeteringMode | meteringmode | 文字列 | * |
| kMDItemMaxAperture | maxaperture | 数値 | * |
| kMDItemFNumber | fnumber fstop | 数値 | |
| kMDItemExposureProgram | exposureprogram | 文字列 | * |
| kMDItemExposureTimeString | 文字列 | * | |
| kMDItemHeadline | headline title | 文字列 | * |
| kMDItemInstructions | instructions | 文字列 | * |
| kMDItemCity | city | 文字列 | |
| kMDItemStateOrProvince | state province | 文字列 | |
| kMDItemCountry | country | 文字列 | |
| kMDItemFSName | name filename | 文字列 | |
| kMDItemDisplayName | displayname | 文字列 | |
| kMDItemPath | pathname path | 文字列 | * |
| kMDItemFSSize | size | 数値 ※byte | |
| kMDItemFSCreationDate | created date | 日付 | |
| kMDItemFSContentChangeDate | modifed date | 日付 | |
| kMDItemFSOwnerUserID | owner | 数値 | |
| kMDItemFSOwnerGroupID | group | 数値 | |
| kMDItemFSExists | 非推奨 | ||
| kMDItemFSIsReadable | 非推奨 | ||
| kMDItemFSIsWriteable | 非推奨 | ||
| kMDItemFSHasCustomIcon | Boolean | * | |
| kMDItemFSIsExtensionHidden | Boolean | ||
| kMDItemFSIsStationery | stationery | Boolean | * |
| kMDItemFSInvisible | invisible | Boolean | |
| kMDItemFSLabel | label | 数値 ※0-7 | |
| kMDItemFSNodeCount | 数値 | ||
| kMDItemTextContent | intext | 文字列 | |
| kMDItemAudioSampleRate | audiosamplerate samplerate | 数値 | |
| kMDItemAudioChannelCount | channels | 数値 | |
| kMDItemTempo | tempo | 数値 | |
| kMDItemKeySignature | keysignature key | 文字列 | * |
| kMDItemTimeSignature | timesignature | 文字列 | |
| kMDItemAudioEncodingApplication | audioencodingapplication encodingapplication | 文字列 | |
| kMDItemComposer | composer author, by | 文字列 | |
| kMDItemLyricist | lyricist author, by | 文字列 | * |
| kMDItemAudioTrackNumber | tracknumber | 数値 | |
| kMDItemRecordingDate | recordingdate date | 日付 | * |
| kMDItemMusicalGenre | musicalgenre genre | 文字列 | |
| kMDItemIsGeneralMIDISequence | ismidi | Boolean | * |
| kMDItemRecordingYear | yearrecorded year | 数値 | |
| kMDItemOrganizations | organization | 文字列 | |
| kMDItemLanguages | language | 文字列 | |
| kMDItemRights | rights | 文字列 | * |
| kMDItemPublishers | publisher | 文字列 | |
| kMDItemContributors | contributor author, by, with | 文字列 | * |
| kMDItemCoverage | coverage | 文字列 | * |
| kMDItemSubject | subject title | 文字列 | |
| kMDItemTheme | theme | 文字列 | * |
| kMDItemDescription | description | 文字列 | |
| kMDItemIdentifier | id | 文字列 | * |
| kMDItemAudiences | audience to | 文字列 | |
| kMDItemNumberOfPages | pages | 数値 | |
| kMDItemPageWidth | pagewidth width | 数値 | |
| kMDItemPageHeight | pageheight height | 数値 | |
| kMDItemSecurityMethod | securitymethod | 文字列 | |
| kMDItemCreator | creator | 文字列 | |
| kMDItemEncodingApplications | encodingapplication | 文字列 | |
| kMDItemDueDate | duedate date | 日付 | |
| kMDItemStarRating | starrating | 数値 | * |
| kMDItemPhoneNumbers | phonenumber | 文字列 | |
| kMDItemEmailAddresses | 文字列 | ||
| kMDItemInstantMessageAddresses | imname | 文字列 | |
| kMDItemKind | kind | 文字列 | |
| kMDItemRecipients | recipient to, with | 文字列 | |
| kMDItemFinderComment | spotlightcomment comment | 文字列 | |
| kMDItemFonts | font | 文字列 | |
| kMDItemAppleLoopsRootKey | 文字列 | * | |
| kMDItemAppleLoopsKeyFilterType | 文字列 | * | |
| kMDItemAppleLoopsLoopMode | 文字列 | * | |
| kMDItemAppleLoopDescriptors | 文字列 | * | |
| kMDItemMusicalInstrumentCategory | instrumentcategory | 文字列 | |
| kMDItemMusicalInstrumentName | instrumentname | 文字列 | |
| kMDItemCFBundleIdentifier | 文字列 | * | |
| kMDItemSupportFileType | 文字列 | * | |
| kMDItemInformation | 文字列 | * | |
| kMDItemDirector | 文字列 | * | |
| kMDItemProducer | producer | 文字列 | * |
| kMDItemGenre | genre | 文字列 | |
| kMDItemPerformers | 文字列 | * | |
| kMDItemOriginalFormat | 文字列 | * | |
| kMDItemOriginalSource | 文字列 | * | |
| kMDItemAuthorEmailAddresses | 文字列 | * | |
| kMDItemRecipientEmailAddresses | 文字列 | * | |
| kMDItemURL | url | 文字列 |
■ 参考情報
最後に、Part1、Part2をまとめる上で参考になった情報源を紹介します。
- Mac OS X 10.5 Help
Spotlightのショートカット
検索フィールドで条件を指定する - Spotlightスレ
[スマートフォルダ]Spotlightを使いこなそう! 4[検索] - Apple Developer Connection
Spotlight Metadata Attributes Reference - Mac OS X Hints
Advanced Spotlight Menu Search(PDF) - OS X ハッキング
(133)虎飼い日記 その1 - 噂のSpotlightをTerminalで使う
(134)虎飼い日記 その2 - 噂のSpotlightを手なずける
0 件のコメント:
コメントを投稿