@Override
    public Iterator<Text> search(String term) {
        if (invertedFile.containsKey(term)) {
            ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term));
            return hits.iterator();
        } else {
            return Collections.emptyIterator();
        }
    }
@Test
    public void testSearchRomanticComedy() {
        System.out.println("search 'romantic comedy'");
        String[] terms = {"romantic", "comedy"};
        Iterator<Relevance> hits = corpus.search(new BM25(), terms);
        int n = 0;
        while (hits.hasNext()) {
            n++;
            Relevance hit = hits.next();
            System.out.println(hit.text + "\t" + hit.score);
        }
        assertEquals(78, n);
    }