2008年6月22日日曜日

Spotlightを使いこなす! - Part2

Part1から続きました!)

■ 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文字列
kMDItemKeywordskeyword文字列
kMDItemTitletitle文字列
kMDItemAuthorsauthor
from, with, by
文字列
kMDItemEditorseditor文字列*
kMDItemProjectsproject文字列*
kMDItemWhereFromswherefrom文字列
kMDItemCommentcomment文字列
kMDItemCopyrightcopyright文字列
kMDItemLastUsedDatelastused
used, date
日付
kMDItemContentCreationDatecontentcreated
created, date
日付
kMDItemContentModificationDatecontentmodified
modified, date
日付
kMDItemDurationSecondsduration
time
数値
※秒
kMDItemContactKeywordscontactkeyword
keyword
文字列
kMDItemVersionversion文字列

kMDItemPixelHeightpixelheight
height
数値
kMDItemPixelWidthpixelwidth
width
数値
kMDItemColorSpacecolorspace文字列
kMDItemBitsPerSamplebitspersample
bps
数値
kMDItemFlashOnOffflashBoolean
kMDItemFocalLengthfocallength数値
kMDItemAcquisitionMakemake文字列
kMDItemAcquisitionModelmodel文字列
kMDItemISOSpeedISO数値
※大文字
kMDItemOrientationorientation数値
kMDItemLayerNameslayer文字列
kMDItemWhiteBalancewhitebalance文字列
kMDItemApertureaperture
fstop
数値
kMDItemProfileNameprofile文字列
kMDItemResolutionWidthDPIwidthdpi数値
kMDItemResolutionHeightDPIheightdpi数値
kMDItemExposureModeexposuremode数値
kMDItemExposureTimeSecondsexposuretime数値
kMDItemEXIFVersionexifversion文字列

kMDItemEXIFGPSVersion文字列*
kMDItemAltitudealtitude数値*
kMDItemLatitudelatitude数値*
kMDItemLongitudelongitude数値*
kMDItemSpeed数値*
kMDItemTimestamp日付*
kMDItemGPSTrack数値*
kMDItemImageDirection数値*

kMDItemCodecscodec文字列
kMDItemMediaTypesmediatype文字列
kMDItemStreamablestreamableBoolean
kMDItemTotalBitRatetotalbitrate
bitrate
数値
kMDItemVideoBitRatevideobitrate
bitrate
数値
kMDItemAudioBitRateaudiobitrate
bitrate
数値
kMDItemDeliveryTypedelivery文字列*

kMDItemAlbumalbum
title
文字列
kMDItemHasAlphaChannelalpha数値
kMDItemRedEyeOnOffredeyeBoolean
kMDItemMeteringModemeteringmode文字列*
kMDItemMaxAperturemaxaperture数値*
kMDItemFNumberfnumber
fstop
数値
kMDItemExposureProgramexposureprogram文字列*
kMDItemExposureTimeString文字列*

kMDItemHeadlineheadline
title
文字列*
kMDItemInstructionsinstructions文字列*
kMDItemCitycity文字列
kMDItemStateOrProvincestate
province
文字列
kMDItemCountrycountry文字列

kMDItemFSNamename
filename
文字列
kMDItemDisplayNamedisplayname文字列
kMDItemPathpathname
path
文字列*
kMDItemFSSizesize数値
※byte
kMDItemFSCreationDatecreated
date
日付
kMDItemFSContentChangeDatemodifed
date
日付
kMDItemFSOwnerUserIDowner数値
kMDItemFSOwnerGroupIDgroup数値
kMDItemFSExists非推奨
kMDItemFSIsReadable非推奨
kMDItemFSIsWriteable非推奨
kMDItemFSHasCustomIconBoolean*
kMDItemFSIsExtensionHiddenBoolean
kMDItemFSIsStationerystationeryBoolean*
kMDItemFSInvisibleinvisibleBoolean
kMDItemFSLabellabel数値
※0-7
kMDItemFSNodeCount数値

kMDItemTextContentintext文字列

kMDItemAudioSampleRateaudiosamplerate
samplerate
数値
kMDItemAudioChannelCountchannels数値
kMDItemTempotempo数値
kMDItemKeySignaturekeysignature
key
文字列*
kMDItemTimeSignaturetimesignature文字列
kMDItemAudioEncodingApplicationaudioencodingapplication
encodingapplication
文字列
kMDItemComposercomposer
author, by
文字列
kMDItemLyricistlyricist
author, by
文字列*
kMDItemAudioTrackNumbertracknumber数値
kMDItemRecordingDaterecordingdate
date
日付*
kMDItemMusicalGenremusicalgenre
genre
文字列
kMDItemIsGeneralMIDISequenceismidiBoolean*
kMDItemRecordingYearyearrecorded
year
数値

kMDItemOrganizationsorganization文字列
kMDItemLanguageslanguage文字列
kMDItemRightsrights文字列*
kMDItemPublisherspublisher文字列
kMDItemContributorscontributor
author, by, with
文字列*
kMDItemCoveragecoverage文字列*
kMDItemSubjectsubject
title
文字列
kMDItemThemetheme文字列*
kMDItemDescriptiondescription文字列
kMDItemIdentifierid文字列*
kMDItemAudiencesaudience
to
文字列

kMDItemNumberOfPagespages数値
kMDItemPageWidthpagewidth
width
数値
kMDItemPageHeightpageheight
height
数値
kMDItemSecurityMethodsecuritymethod文字列
kMDItemCreatorcreator文字列
kMDItemEncodingApplicationsencodingapplication文字列
kMDItemDueDateduedate
date
日付
kMDItemStarRatingstarrating数値*
kMDItemPhoneNumbersphonenumber文字列
kMDItemEmailAddressesemail文字列
kMDItemInstantMessageAddressesimname文字列
kMDItemKindkind文字列
kMDItemRecipientsrecipient
to, with
文字列
kMDItemFinderCommentspotlightcomment
comment
文字列
kMDItemFontsfont文字列

kMDItemAppleLoopsRootKey文字列*
kMDItemAppleLoopsKeyFilterType文字列*
kMDItemAppleLoopsLoopMode文字列*
kMDItemAppleLoopDescriptors文字列*
kMDItemMusicalInstrumentCategoryinstrumentcategory文字列
kMDItemMusicalInstrumentNameinstrumentname文字列

kMDItemCFBundleIdentifier文字列*
kMDItemSupportFileType文字列*

kMDItemInformation文字列*
kMDItemDirector文字列*
kMDItemProducerproducer文字列*
kMDItemGenregenre文字列
kMDItemPerformers文字列*
kMDItemOriginalFormat文字列*
kMDItemOriginalSource文字列*
kMDItemAuthorEmailAddresses文字列*
kMDItemRecipientEmailAddresses文字列*
kMDItemURLurl文字列
※分からなかった項目は空欄にしてあります。また、「*」は私の環境では確認できなかった項目です。


■ 参考情報
最後に、Part1、Part2をまとめる上で参考になった情報源を紹介します。

0 件のコメント: