Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

deleteByQuery may have a bug #111

Closed
wants to merge 1 commit into from

2 participants

@tksohishi

Hi tjake,

I tried to clean all documents in solandra with delete_by_query in ruby client, and it looked working with no documents returned, but after that, I can't add the document with the same id.

I'm not Java guy, so this pull request is written just for adding the tests which will fail, but it should work, I believe.

Thanks,
-- Takeshi

@tjake tjake closed this
@tjake
Owner

Thanks for the info, this was fixed by d1e0ff1

@tksohishi

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 0 deletions.
  1. +31 −0 test/solandra/SolandraTests.java
View
31 test/solandra/SolandraTests.java
@@ -429,6 +429,22 @@ public void testDeleteTerm(CommonsHttpSolrServer solrClient) throws Exception
QueryResponse r = solrClient.query(q);
assertEquals(3, r.getResults().getNumFound());
+ // Try to check whether the document should be saved just after deleteById
+ SolrInputDocument doc = new SolrInputDocument();
+
+ doc.addField("title", "test4");
+ doc.addField("url", "http://www.test4.com");
+ doc.addField("text", "this is a test4 of Solandra");
+ doc.addField("user_id_i", 100);
+ doc.addField("price", 10);
+
+ solrClient.add(doc);
+
+ QueryResponse r2 = solrClient.query(q);
+ assertEquals(4, r2.getResults().getNumFound());
+
+ solrClient.deleteById("http://www.test4.com");
+ solrClient.commit(true, true);
}
public void testUpdateDocument(CommonsHttpSolrServer solrClient) throws Exception
@@ -467,6 +483,21 @@ public void testDeleteByQuery(CommonsHttpSolrServer solrClient) throws Exception
QueryResponse r = solrClient.query(q);
assertEquals(0, r.getResults().getNumFound());
+
+ // Try to check whether the document should be saved just after deleteByQuery
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("title", "test1");
+ doc.addField("url", "http://www.test.com");
+ doc.addField("text", "this is a test of Solandra");
+ doc.addField("user_id_i", 10);
+ doc.addField("price", 1000);
+
+ solrClient.add(doc);
+ solrClient.commit(true, true);
+
+ QueryResponse r2 = solrClient.query(q);
+
+ assertEquals(1, r2.getResults().getNumFound());
}
public void testQueryFilter(CommonsHttpSolrServer solrClient) throws Exception
Something went wrong with that request. Please try again.