LuceneHelper { public List<Integer> query(String query, String field, int n) { searcher = getSearcher(); TopScoreDocCollector collector = TopScoreDocCollector.create(n, true); List<Integer> results = new ArrayList<Integer>(); Query q = null; try { q = new QueryParser(Version.LUCENE_41, field, new StandardAnalyzer( Version.LUCENE_41)).parse("\"" + query + "\""); } catch (ParseException e) { logger.error("querying the index: {} ", e.toString()); return results; } try { searcher.search(q, collector); } catch (IOException e) { logger.error("querying the index: {} ", e.toString()); return results; } ScoreDoc[] hits = collector.topDocs().scoreDocs; for (int i = 0; i < hits.length; ++i) { int docId = hits[i].doc; results.add(getWikiId(docId)); } logger.debug("query {} docs {}", query, results); return results; } 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 testQuery() { List<Integer> results = helper.query("diego"); assertEquals(3, results.size()); Set<Integer> expected = new HashSet<Integer>(); expected.add(1); expected.add(4); expected.add(5); assertEquals(expected, new HashSet<Integer>(results)); }