Re: kMDItemTextContent for an item's content - no alternative?
Re: kMDItemTextContent for an item's content - no alternative?
- Subject: Re: kMDItemTextContent for an item's content - no alternative?
- From: Jonathon Mah <email@hidden>
- Date: Fri, 2 Jun 2006 01:17:18 +0930
Hi Philip,
On 2006-06-01, at 22:25, Philip Dow wrote:
The spotlight docs clearly state that applications cannot request
the kMDItemTextContent attribute from an MDItemRef. [...] Is there
no way to work around this?
/usr/bin/mdls does not list the attribute, but /usr/bin/mdimport at
debug level 2 does. I suppose I could parse the returned string and
extract the information, but I'm not very interested in doing this.
Is there really no other way to get the spotlighted textual content
of a file?
From what I understand, the text content differs from other
attributes in that it is not stored in the item's Spotlight record.
Instead it is used to hash the record in a table of words, so a
search for "macro" would return the items contained in that word ---
but there is no easy way to go backwards (to get the words from an
item). The text content string has a lot of redundancy anyway
(duplicated words, irrelevant whitespace, etc.). So Spotlight is
optimized for searching, not retrieving (in the case of text content).
Of course, mdimport can show it because it just imported it --- but
it's not stored in the metadata store. I think you may be out of
luck, unless calling mdimport is a viable option.
The spotlight-dev list may be more appropriate for this question, or
you might have more luck finding a solution there.
Jonathon Mah
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden