|
|
10.4: Make Spotlight index PHP files
You shouldn't expect this (or any other importer) to work with any arbitrary file types just by modifying the mdimporter's Info.plist
Mdimporters are crafted for particular types of data and the authors of the importers know best how to set up their Info.plist Hacking on the Info.plist is taking a gamble. Maybe it'll work. Maybe it'll work most of the time. But you're asking for trouble in the long run. When mdimpor crashs it does so silently in the background. The end user won't know unless she is paying close attention that anything is wrong. If you want an mdimporter for some particular file format then ask the developer of the file format/write it yourself/find someone to write it for you. Don't just randomly modify config files and hope.
Use the RichText.mdimporter instead
I understand your concerns... and therefore suggest modifying /System/Library/Spotlight/RichText.mdimporter/ as all that plugin is looking for is simple text.
Use the RichText.mdimporter instead
Well I've had a quick sniff around Apple's Source Code mdimporter and all it seems to do is copy the contents of the file into the "kMDItemTextContent" attribute. This means it _should_ work for any kind of file. But of course I could be mistaken.
Use the RichText.mdimporter instead
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.
Use the RichText.mdimporter instead
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. 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.
Use the RichText.mdimporter instead
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:
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?
Use the RichText.mdimporter instead
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 http://toxicsoftware.com/blog/ for progress. Feel free to continue this thread on my blog.
Use the RichText.mdimporter instead
Code written (not actually based on my Python code):
http://toxicsoftware.com/blog/index.php/weblog/creating_a_generic_config_file_spotlight_importer/
Use the RichText.mdimporter instead
Wow--thanks. Im downloading now and will try ASAP.
Use the RichText.mdimporter instead
There's a new version online now that imports .conf, .log and .plist. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.17 seconds |
|