Hello everybody,

 

I build a website (Java EE ) and want to search in some json files so I 
installed the solr server in an Ubuntu server and create a new core then 
indexing json files and the web searched correctly when I moved my code from 
windows to the server it stopped and cannot connect to solr server I try to 
debug using netbeans in Ubuntu it’s stopped and there is no exception on this 
statement (SolrServer server = new 
HttpSolrServer(“localhost:8983/solr/SearchCore”) ).

 

I need for some help Please.

 

Note :- I attached the servlet I used to search and connect to solr server.

 

Regards,
Adel Khalifa

 

protected void processRequest(HttpServletRequest request, HttpServletResponse 
response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        try {
            SolrServer server = new 
HttpSolrServer("http://localhost:8983/solr/SearchCore";);

            ModifiableSolrParams params = new ModifiableSolrParams();
            String qqq = new 
String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8");
            params.set("q", new 
String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8"));
            params.set("rows", "30000");
            

            params.set("spellcheck", "on");
            params.set("spellcheck.build", "true");
            params.set("wt", "json");
            params.set("indent", "true");
           
            PrintWriter out = response.getWriter();
            QueryResponse res = server.query(params);

            SolrDocumentList results = res.getResults();
            Iterator i = results.iterator();
            request.setAttribute("size", results.size());
            String json = new Gson().toJson(res.getResults());
            out.write(json);
        } catch (SolrServerException ex) {
            System.out.println(ex.toString());
        }

    }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to