SynonymIndexSearcher { public String getWordByDocNumber(int docNo) { Document document = getDocument(docNo); return document != null ? document.getValues(F_WORD)[0] : null; } @Deprecated  SynonymIndexSearcher();  SynonymIndexSearcher(String indexPath);   SynonymIndexSearcher(Directory indexDir); void openIndexInFS(String path); TopDocs searchDocumentByWord(String word); TopDocs searchDocumentBySynonym(String stringToSearch); int getSynonymCount(String word); Document getDocument(int docNum); String getWordByDocNumber(int docNo); String[] getSynonymsByDocNumber(int docNo); int getNumDocs(); int getMaxDoc(); int getTopDocLimit(); void setTopDocLimit(int topDocLimit); int getSlop(); void setSlop(int slop); void setAnalyzer(Analyzer analyzer); Analyzer getAnalyzer(); void close(); SynonymSearchMode getSearchMode(); void setSearchMode(SynonymSearchMode searchMode); void setMaxEdits(int maxEdits); float getMatchingThreshold(); void setMatchingThreshold(float matchingThreshold); void setMatchingThreshold(double matchingThreshold); static List<String> getTokensFromAnalyzer(String input); static final String F_WORD; static final String F_SYN; static final String F_WORDTERM; static final String F_SYNTERM; }
@Test public void testGetWordByDocNumber() { SynonymIndexSearcher search = new SynonymIndexSearcher(); try { search.openIndexInFS(INDEX_PATH); } catch (IOException e) { fail(e.getMessage()); } String word = search.getWordByDocNumber(0); assertNotNull(word); assertNotSame(0, word.length()); boolean wordFound = false; for (int i = 0; i < SynonymIndexBuilderTest.synonyms.length; i++) { String[] input = SynonymIndexBuilderTest.synonyms[i]; if (word.equals(input[0])) { wordFound = true; break; } } assertTrue(wordFound); search.close(); }