public int addIndexDocuements(String hostUrl) throws IOException {
                HttpSolrServer solrServer =
getServer("http://localhost:7001/solr/collection1/";);
        
                int res=1;
                  try {  
                          Collection<SolrInputDocument> docs = new
ArrayList<SolrInputDocument>();  
                    
                  
                        SolrInputDocument doc = new SolrInputDocument();  
                        doc.addField("id", "1111");  
                        doc.addField("title", "test");  
                        docs.add(doc);
                   
                    solrServer.add(docs);       
                    
                    solrServer.commit();  
                }catch(SolrServerException e) {  
                    System.out.println("Add docs Exception !!!");  
                    e.printStackTrace();          
                }catch(IOException e){  
                    e.printStackTrace();  
                }catch (Exception e) {  
                    System.out.println("Unknowned Exception!!!!!");  
                    e.printStackTrace();  
                }
        }


public HttpSolrServer getServer(String hostUrl) {
                HttpSolrServer server = null;
                server = new HttpSolrServer(hostUrl);
                server.setConnectionTimeout(100);
                server.setDefaultMaxConnectionsPerHost(100);
                server.setMaxTotalConnections(100);
                return server;
        }




--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-solr4-0-and-zookeeper-run-on-weblogic-tp4013882p4014439.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to