Sorry everyone. Found the issue. It was because of a very stupid assumption.
My code and solr were running as 2 different processes! ( Weird part is that when I run the code using EmbeddedSolrServer, it did not throw any exception that there was already a server running on that port. ) Thanks! On Mon, Jul 20, 2009 at 3:41 PM, Code Tester < codetester.codetes...@gmail.com> wrote: > Another observation: > > I am even unable to delete documents using the EmbeddedSolrServer ( on a > specific core ) > > Steps: > > 1) I have 2 cores ( core0 , core1 ) Each of them have ~10 records. > > 2) System.setProperty("solr.solr.home", > "/home/user/projects/solr/example/multi"); > File home = new File("/home/user/projects/solr/example/multi"); > File f = new File(home, "solr.xml"); > CoreContainer coreContainer = new CoreContainer(); > coreContainer.load("/home/user/projects/solr/example/multi", f); > SolrServer server = new EmbeddedSolrServer(coreContainer, "core1"); > > server.deleteByQuery("*:*"); > server.commit(); > server.optimize(); > > 3) When I check the status using > http://localhost:8983/solr/admin/cores?action=STATUS , I still see same > number of numDocs. > > 4) If I try deleting using CommonsHttpSolrServer, it works fine > String url = "http://localhost:8983/solr/core1"; > CommonsHttpSolrServer server = new CommonsHttpSolrServer(url); > server.setSoTimeout(1000); // socket read timeout > server.setConnectionTimeout(100); > server.setDefaultMaxConnectionsPerHost(100); > server.setMaxTotalConnections(100); > server.setFollowRedirects(false); // defaults to false > server.setAllowCompression(true); > server.setMaxRetries(1); // defaults to 0. > 1 not recommended. > server.setRequestWriter(new BinaryRequestWriter()); > > server.deleteByQuery("*:*"); > server.commit(); > server.optimize(); > > Thanks! > > > On Mon, Jul 20, 2009 at 3:26 PM, Code Tester < > codetester.codetes...@gmail.com> wrote: > >> I am using solr 1.4 dev in a multicore way. Each of my core's >> solrconfig.xml has the following lines >> >> <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> >> <requestHandler name="/update/javabin" >> class="solr.BinaryUpdateRequestHandler" /> >> >> I am using SolrJ as EmbeddedSolrServer. When I try to add a POJO ( with >> @Field annotations ), the data does not get indexed. Where as, if I use >> SolrInputDocument way, the data gets indexed. >> >> PS: Both ways I am adding data using addBean/add and then commit followed >> by optimize >> >> PPS: The final intention is that all the indexing and searching needs to >> be done in the binary format since I am running on a single machine. >> >> Could someone provide insights on this issue ? >> >> Thanks! >> >> >> >> > >