Re: Retrieving Uniform Type Identifiers
Re: Retrieving Uniform Type Identifiers
- Subject: Re: Retrieving Uniform Type Identifiers
- From: Dave DeLong <email@hidden>
- Date: Mon, 26 Jul 2010 17:34:47 -0600
On Jul 26, 2010, at 5:22 PM, Ken Thomases wrote:
> On Jul 26, 2010, at 5:59 PM, Dave DeLong wrote:
>
>> Yeah, I'm actually trying to expand Spotlight queries into a different format so I can execute them on a SQLite database
>
> Huh? I can't figure out what you mean by that.
>
> You want to let Spotlight find things from within a database? Then you want to write an importer, although that may still not give you what you want, since Spotlight is file-oriented.
>
> Or you want to add features to the Spotlight query language?!? Or you want to create an alternative query language for Spotlight queries?
>
> Or you want to query an SQLite database and you're for some reason considering Spotlight for that, rather than ordinary SQL or predicates or whatever?
>
> Whatever it is that you're trying to do, it sounds like you're trying to shoehorn a technique/tool appropriate to some circumstances into another circumstance where it isn't appropriate.
>
> Finally, if you want to make an SQLite database indexable by Spotlight, maybe a MacFUSE file system view into the database would help?
None of the above. I work on an application that used to use Spotlight for file retrieval. However, when we discovered the root user vs regular user discrepancy of spotlight results, we switched to our own Spotlight-like database that's maintained by this root process.
Part of this process involved taking our existing Spotlight queries (with a limited number of supported attributes) and translating them into SQL statements. As we continue to upgrade our schema, we have to continue finding ways to map our old Spotlight-style stuff to fit the new schema. Where before we stored the content type (kMDItemContentType) in our database, we now just store the file extension, hence the desire to map a wildcard content type to specific UTIs so we can extract all of the extensions to include in the generated query. (the reason for this change is speed: it is *much* faster to simply grab a path and extract an extension than it is to grab a path and extract the content type. And for this application, performance is critical)
It's really convoluted because we're dealing with a whole bunch of legacy code, but we're slowly working on getting things cleaned up. This particular example is a corner case of our upgrade path, but it's a corner case that we would really like to cover, if at all possible.
> I'm not at all certain that LaunchServices (and lsregister -dump) gives the same results when run as root vs. a normal user.
At first glance, running it as root seems to return more information. A simple pipe to wc -l shows that it returns 35064 lines as a user as 46466 lines as root (on my machine).
Dave
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden