> > Where am I going wrong?? > I think you forgot to "commit" after adding beans via the SolrServer.
PS: I am damn sure that you don't intend to create a new instance of CommonsHttpSolrServer everytime. Cheers Avlesh On Mon, Aug 10, 2009 at 5:55 PM, Ninad Raut <hbase.user.ni...@gmail.com>wrote: > I am not getting any excpetion, but the document is not getting added to > Solr. > Here is the code: > public class ClientSearch { > > public SolrServer getSolrServer() throws MalformedURLException{ > //the instance can be reused > return new CommonsHttpSolrServer("http://germinait22:8983/solr/core0/"); > } > > void store() throws IOException, SolrServerException { > IthursDocument ithursDocument = new IthursDocument(); > System.out.println("Created IthursDocument.."); > ithursDocument.setId("testID_2"); > ithursDocument.setMedia("BLOG"); > ithursDocument.setContent("Khatoo is a good Gal"); > Date date = new Date("23/08/2009"); > ithursDocument.setPubDate(date); > Map<String,String> namedEntity = new HashMap<String,String>(); > namedEntity.put("Germinait", "0.7"); > ithursDocument.setNe(namedEntity); > ithursDocument.setSentiment(0.1f); > SolrServer server = getSolrServer(); > server.addBean(ithursDocument); > } > > void query() throws MalformedURLException, SolrServerException { > SolrServer server = getSolrServer(); > SolrQuery query = new SolrQuery(); > query.setQuery("id:testID"); > > QueryResponse rsp = server.query(query); > List<IthursDocument> list= rsp.getBeans(IthursDocument.class); > System.out.println(list.size()); > > } > > public static void main(String[] args) { > ClientSearch clientSearch = new ClientSearch(); > try { > clientSearch.store(); > clientSearch.query(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (SolrServerException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > The logs show the following: > 192.168.0.115 - - [10/08/2009:12:10:47 +0000] "POST > /solr/core0/update?wt=javabin&version=1 HTTP/1.1" 200 40 > Where am I going wrong?? >