LuceneHelper { public int getFreq(String query, String field) { Query q = null; searcher = getSearcher(); TopScoreDocCollector collector = TopScoreDocCollector.create(1, true); Text t = new Text(query).disableStopwords(); PhraseQuery pq = new PhraseQuery(); int i = 0; for (String term : t.getTerms()) { pq.add(new Term(field, term), i++); } q = pq; logger.debug(q.toString()); try { searcher.search(q, collector); } catch (IOException e) { logger.error("querying the index: {} ", e.toString()); return -1; } return collector.getTotalHits(); } protected  LuceneHelper(File wikiIdtToLuceneIdSerialization, File indexPath); static boolean hasDexterLuceneIndex(); static LuceneHelper getDexterLuceneHelper(); @SuppressWarnings("unchecked") void loadWikiIdToLuceneId(); float getSimilarity(Query query, int wikiId); double getCosineSimilarity(int x, int y); double getCosineSimilarity(int x, int y, String field); void addDocument(Article a); void clearIndex(); void commit(); int getFreq(String query, String field); int getFreq(String query); int getFreqFromSummary(String query); int numDocs(); void closeWriter(); List<Integer> query(String query, String field, int n); List<Integer> query(String query, String field); List<Integer> query(String query); Article getArticle(int id); Article getArticleSummary(int id); int getWikiId(int luceneId); @SuppressWarnings("null") void rankBySimilarity(SpotMatch spot, EntityMatchList eml,
			String context, String field); void rankBySimilarity(SpotMatch spot, EntityMatchList eml,
			String context);  }
@Test public void testFreq() { assertEquals(1, helper.getFreq("diego ceccarelli")); assertEquals(5, helper.getFreq("ceccarelli test")); assertEquals(5, helper.getFreq("test1 test2")); assertEquals(5, helper.getFreq("and")); assertEquals(2, helper.getFreq("diego and ceccarelli")); }