public void indexContentSpecificMet(File file) throws Exception {
        Metadata met = new Metadata();
        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