Posts

Showing posts with the label SolrJ

Using Solr Spellchecker from Java

Continuing from my prevoius post Implementing Spellchecker in Solr , we'll now see how to use SorlJ API to fetch spellcheck suggestions through a Java program. public static Map<String, List<String>> getSuggestions(String queryStr){ if (queryStr != null &&  !queryStr.isEmpty()) { try { SolrServer server = new HttpSolrServer("http://localhost:8983/solr ");    ModifiableSolrParams params = new ModifiableSolrParams();    params.set("qt", "/spell");    params.set("q", queryStr);    params.set("spellcheck", "true");    params.set("spellcheck.collate", "true");    QueryResponse response = server.query(params);    System.out.println("response = " + response);    if(response != null){       SpellCheckResponse scr = response.getSpellCheckResponse();     if(scr != null...