lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ninad Raut <hbase.user.ni...@gmail.com>
Subject Pojo not getting added to Solr Index
Date Mon, 10 Aug 2009 12:25:12 GMT
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??

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message