import com.groupdocs.search.Index; import com.groupdocs.search.licenses.License; import com.groupdocs.search.options.SearchOptions; import com.groupdocs.search.results.SearchResult; public class PerformSynonymSearchusingJava { public static void main(String[] args) throws Exception { // Apply the license to remove the restrictions // imposed by the Search library License license = new License(); license.setLicense("GroupDocs.Search.lic"); // The path where the index will be stored String indexFolder = "c:\\MyIndex\\"; // The folder containing the documents you want to search String documentsFolder = "c:\\MyDocuments\\"; // Creating an index in the specified folder Index index = new Index(indexFolder); // Indexing documents from the specified folder index.add(documentsFolder); // Creating a search options object SearchOptions options = new SearchOptions(); // Enabling synonym search options.setUseSynonymSearch(true); // Search for the word 'answer' // In addition to the word 'answer', the words 'reply' // and 'response' will also be found SearchResult result = index.search("answer", options); } }