Writing a custom Spotlight Importer

  • Hello everybody,

    I've written a Spotlight Importer for my custom document format. The
    document has an UTI, used by the Spotlight Importer.

    Everything is fine, I can see my Metadata Fields correctly indexed by
    Spotlight, I can see the right importer loaded (it is bundled into the
    .app) when I run `mdimport -L`, except the Finder doesn't display the
    fields I've said it to display.

    Here is what the schema.xml file look like :

      <?xml version="1.0" encoding="UTF-8"?>

      <schema version="1.0"
          xmlns="http://www.apple.com/metadata"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
    http://www.apple.com/metadatafile:///System/Library/Frameworks/CoreServices
    .framework/Frameworks/Metadata.framework/Resources/MetadataSchema.xsd

    ">
      <attributes>
          <attribute name="com_myDomain_myApp_myDocument_test"
    multivalued="false" type="CFString" />
      </attributes>
      <types>
          <type name="com.myDomain.myapp.mydocument">
              <allattrs>
                  kMDItemTitle
                  kMDItemAuthors
                  kMDItemAlbum
                  com_myDomain_myApp_myDocument_test
              </allattrs>
              <displayattrs>
                  kMDItemTitle
                  kMDItemAuthors
                  kMDItemAlbum
                  com_myDomain_myApp_myDocument_test
              </displayattrs>
          </type>
      </types>
    </schema>

    I wasn't able to validate this file syntax (but it seems right), my system
    is lacking the `mdcheckschema` command, and I can't find it anywhere. Also
    I thought that fields appearing in the `<displayattrs>` would have been
    displayed by the Finder's Get Info pane.

    The `schema.xml` file appears at the right place into the mdimporter
    bundle. This is really annoying, since I use already defined fields, and
    only one custom field. Apple's documentation doesn't tell anything on this
    situation and I wasn't able to find an answer to my problem.

    Does anybody know what to do to have those informations displayed by the
    Finder's "More Info" section ?
    Maybe someone can provide useful tips ?

    Vince.
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today