Houdah Software Forum Archive

kMDKeyphraseLabels

Member #1130

macOS now has kMDItemKeyphraseLabels and kMDItemKeyphraseConfidences metadata for PDFs and other document formats. I am not sure when these were added to macOS, but are present in macOS 15.3.1.

We can now use

      mdfind '(kMDItemKeyphraseLabels == "wine*"cdw)'

to provide more selective results than

     mdfind '(** == "wine*"cdw)'

So:

1) Suggestion: "Keyphrase Labels" be incorporated into HS.

2) Thinking aloud: Can they be used as a way of ordering results by relevance.

Houdah Software

What application do you use to create or edit these PDF files?

Do you use an AI-powered application capable of summarizing PDF files?

Can you check using "mdimport -t -d 3" what Spotlight importer plug-in is used to process PDF files?

AFAIK, macOS does not automatically populate kMDItemKeyphraseLabels. I assume that some editing tool summarized the PDF and provided the information. I wonder how it got from there into the Spotlight index. The tool may have set an extended attribute that was picked up by Apple's importer or it may have overridden the default importer.

Member #1130 original poster

Everything seems to be builtin to macOS (15.3.1 and maybe earlier) on both M3 MBP and Intel 2019 iMac.

PDF source: Download, Print to pdf, etc.  As far as I can tell this is for all PDFs (creation and modification dates going back to 1997).  Also for other text formats - docx, pages, rtf, text.

AI and summarisation: Not used - but who knows what happens behind the scenes!

Populating kMDItemKeyphraseLabels: I was surprised too.  I had never heard of them until I did an mdls on a PDF.

Extended attributes: My PDFs do now have new (to me) xattr. My 1997 PDF:

xattr -l /Volumes/T7/Documents/Photo/Adobe/Photoshop/Old/Advanced\\ Techniques/Three\\ New\\ Featues\\ Overview/phsthreenew.pdf

...

com.apple.metadata:kMDItemKeyphraseConfidences: bplist00#?%'>H#?

com.apple.metadata:kMDItemKeyphraseLabels: bplist00\\new features_makes selections_magnetic lasso toolo

com.apple.metadata:kMDItemKeyphraseVersion: bplist00

...

Importer being used is the built-in macOS one.

mdimport -t -d 3 /Volumes/T7/Documents/Photo/Adobe/Photoshop/Old/Advanced\\ Techniques/Three\\ New\\ Featues\\ Overview/phsthreenew.pdf

Imported '/Volumes/T7/Documents/Photo/Adobe/Photoshop/Old/Advanced Techniques/Three New Featues Overview/phsthreenew.pdf' of type 'com.adobe.pdf' with plugIn /System/Library/Spotlight/PDF.mdimporter.

48 attributes returned

{

":EA:kMDItemKeyphraseConfidences" = (

"0.9107853142248756",

"0.1869978904724121",

"0.06547355367778944",

"-0.009569687861480602",

"-0.05784975061345277",

"-0.09546800188760633"

);

":EA:kMDItemKeyphraseLabels" = (

"new features",

"makes selections",

"magnetic lasso tool",

"makes\\U2008simple layer effects",

"type tool",

"adobe senior designer\\U2008lisa jeans trail\\U2008shows"

);

":EA:kMDItemKeyphraseVersion" = 12;

":EA:kMDItemOMManaged" = 1;

":EA:kMDItemOMUserTagTime" = "2013-08-18 03:34:49 +0000";

":EA:kMDItemOMUserTags" = (

);

":EA:kMDItemTextContentLanguage" = en;

":EA:kOMUserTags" = (

);

":MD😃eviceId" = 16777256;

":MD:kMDItemPath" = "/Volumes/T7/Documents/Photo/Adobe/Photoshop/Old/Advanced Techniques/Three New Featues Overview/phsthreenew.pdf";

"_kMDItemContentChangeDate" = "1997-01-02 09:48:18 +0000";

"_kMDItemCreationDate" = "1997-01-02 09:48:18 +0000";

"_kMDItemCreatorCode" = 0;

"_kMDItemDisplayNameWithExtensions" = phsthreenew;

"_kMDItemFileName" = "phsthreenew.pdf";

"_kMDItemFinderFlags" = 80;

 …

I don’t know when the new xattrs and mdls fields were first created. And which came first.  Web search does not give me much except that a few Linux users have seen the xattrs since last August. I don’t think any macOS users have commented on them.

Additional suspicions:

When using Spotlight via Command-space, I suspect that searches do favour documents where the search words are in the kMDItemKeyphraseLabels as well as favouring recently opened documents.

Using the Show More in Command-space results, the Finder window opened is not sorted by any of the usual columns. Perhaps it is using kMDItemKeyphraseLabels as part of its ordering.

I will keep exploring.

Houdah Software

Interesting. The have appeared over night on the test files that I created yesterday on a bare test system. So it must be the doing of macOS, but it does not happen during indexing.

I will do some further digging.