Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Use the RichText.mdimporter instead' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use the RichText.mdimporter instead
Authored by: schwa on May 26, '05 05:14:05PM

I think "asking for trouble" is a bit of an overstatement. As you can see from the UTI tree the SourceCode importer deals with text, and Python and PHP (and HTML for that matter--which does get indexed) is text. I believe the only concern is that Apple could update the importer and overwrite any changes made to the plist file.

Yeah but HTML and PHP and Python are dissimilar enough that one parser probably won't be able to parse all three. Heck why not get the SourceCode file to parse MS Word files - it's all just bytes at the end of the day... Clearly that isn't correct. I'm not saying that changing the Info.plist around will necesarily break anything - in fact it is pretty clear that SourceCode importer can probably do a very basic import on any text file. But the point is - you're taking a risk.

Question: Since you wrote an importer for python you may have an answer for the question I posted above: how to deal with files have kMDItemContentType as "dyn.*"

Don't worry about dyn.* files. They're dynamic UTI types and should not be persistent between reboots. Not sure exactly what causes them (possibly caused by files that are not matched by any UTI description). But Spotlight is smart enough to realise that the dynamic UTI type is actually mapped to a real UTI type.

[ Reply to This | # ]
Use the RichText.mdimporter instead
Authored by: ppmax on May 26, '05 07:59:18PM
Thanks for the reply. Regarding files with type dyn.*: I want to index my httpd.conf file and a few other "generic" system files. mdls /etc/httpd/httpd.conf returns:

/etc/httpd/httpd.conf -------------
kMDItemAttributeChangeDate     = 2005-05-11 08:54:05 -0700
kMDItemContentCreationDate     = 2005-03-20 15:08:49 -0800
kMDItemContentModificationDate = 2005-03-20 15:08:49 -0800
kMDItemContentType             = "dyn.ah62d4rv4ge80g55sq2"
kMDItemContentTypeTree         = ("", "public.item")
kMDItemDisplayName             = "httpd.conf"
kMDItemFSContentChangeDate     = 2005-03-20 15:08:49 -0800
kMDItemFSCreationDate          = 2005-03-20 15:08:49 -0800
kMDItemFSCreatorCode           = 0
kMDItemFSFinderFlags           = 0
kMDItemFSInvisible             = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "httpd.conf"
kMDItemFSNodeCount             = 0
kMDItemFSOwnerGroupID          = 0
kMDItemFSOwnerUserID           = 0
kMDItemFSSize                  = 38334
kMDItemFSTypeCode              = 0
kMDItemID                      = 28530
kMDItemKind                    = "Document"
kMDItemLastUsedDate            = 2005-03-20 15:08:49 -0800
kMDItemUsedDates               = (2005-03-20 15:08:49 -0800)
Provided I add /etc/httpd to the Spotlight index path list, how do I get SL to index this file? What importer will be used? AFAIK Spotlight needs a recognized extension, or a recognized file type to index. Any suggestions?

[ Reply to This | # ]
Use the RichText.mdimporter instead
Authored by: schwa on May 27, '05 02:03:01AM
From the terminal:

mdimport -d2 /etc/httpd/httpd.conf

If you get NO output it means that Spotlight _cannot_ import the file. Which means it could either have no valid mdimporter which claims to be able to understand that file - or it might not be able to index it because Spotlight has been configured not to index files in /etc

You can fix the later by modifying the hidden Spotlight config files - other hints show how to do that. Again I wouldn't recommend it (but I'm dull & boring).

If you're sure Spotlight should be able to import the file (because you have modified the config files) then you also need to write an mdimporter to import config files. ;-)

Of course you could modify SourceCode.mdimporter to handle .conf files but that will be a bit tricky.

But as a favour to you personally (because we go back so far now) I'll take my Python importer and use it to create a .conf file importer. Expect it within the next 24hours or so. Check out for progress. Feel free to continue this thread on my blog.

[ Reply to This | # ]

Use the RichText.mdimporter instead
Authored by: schwa on May 27, '05 06:31:03PM
Use the RichText.mdimporter instead
Authored by: ppmax on May 28, '05 11:18:18AM

Wow--thanks. Im downloading now and will try ASAP.

A suggestion: I know how to modify my spotlight config (/.Spotlight-V100/_rules.plist) but you might want to incude a readme describing how to modify this file to get the importer to work.

Thanks much!

[ Reply to This | # ]
Use the RichText.mdimporter instead
Authored by: schwa on May 31, '05 03:29:15PM

There's a new version online now that imports .conf, .log and .plist.

[ Reply to This | # ]