public void indexWithDublinCore(File file) throws Exception {
        Metadata met = new Metadata();
        met.add(TikaCoreProperties.CREATOR, "Manning");
        met.add(TikaCoreProperties.CREATOR, "Tika in Action");
        met.set(TikaCoreProperties.CREATED, new Date());
        met.set(TikaCoreProperties.FORMAT, tika.detect(file));
        met.set(DublinCore.SOURCE, file
                .toURI()
                .toURL()
                .toString());
        met.add(TikaCoreProperties.SUBJECT, "File");
        met.add(TikaCoreProperties.SUBJECT, "Indexing");
        met.add(TikaCoreProperties.SUBJECT, "Metadata");
        met.set(Property.externalClosedChoise(TikaCoreProperties.RIGHTS.getName(), "public", "private"), "public");
        try (InputStream is = new FileInputStream(file)) {
            tika.parse(is, met);
            Document document = new Document();
            for (String key : met.names()) {
                String[] values = met.getValues(key);
                for (String val : values) {
                    document.add(new TextField(key, val, Store.YES));
                }
                writer.addDocument(document);
            }
        }
    }
Builds on the LuceneIndexer from Chapter 5 and adds indexing of Metadata.
tika-example/src/main/java/org/apache/tika/example/MetadataAwareLuceneIndexer.java