public String generateRSS(Path indexFile) throws CorruptIndexException, IOException {
        StringBuilder output = new StringBuilder();
        output.append(getRSSHeaders());
        IndexSearcher searcher = null;
        try {
            reader = DirectoryReader.open(FSDirectory.open(indexFile));
            searcher = new IndexSearcher(reader);
            GregorianCalendar gc = new java.util.GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
            gc.setTime(new Date());
            String nowDateTime = ISO8601.format(gc);
            gc.add(java.util.GregorianCalendar.MINUTE, -5);
            String fiveMinsAgo = ISO8601.format(gc);
            TermRangeQuery query = new TermRangeQuery(TikaCoreProperties.CREATED.getName(), new BytesRef(fiveMinsAgo), new BytesRef(nowDateTime), true, true);
            TopScoreDocCollector collector = TopScoreDocCollector.create(20, 10000);
            searcher.search(query, collector);
            ScoreDoc[] hits = collector.topDocs().scoreDocs;
            for (ScoreDoc hit : hits) {
                Document doc = searcher.doc(hit.doc);
                output.append(getRSSItem(doc));
            }

        } finally {
            if (reader != null) {
                reader.close();
            }
        }

        output.append(getRSSFooters());
        return output.toString();
    }
Builds on top of the LuceneIndexer and the Metadata discussions in Chapter 6
to output an RSS (or RDF) feed of files crawled by the LuceneIndexer within
the last N minutes.
tika-example/src/main/java/org/apache/tika/example/RecentFiles.java