Is it expected behaviour that "deleteById" will always return OK as a
status, regardless of whether the id was matched?

I have a unit test:

          // set up the test data
engine.index(12345, s1, d1);
engine.index(54321, s2, d2);
engine.index(23453, s3, d3);

// ...

    @Test
    public void testRemove() throws Exception {
        assertEquals(engine.size(), 3);
        assertTrue(engine.remove(12345));
        assertEquals(engine.size(), 2);
        // XXX, it returns true
        assertFalse(engine.remove(23523352));

"Engine" is my wrapper around Solr. The remove method looks like this:

private static final int RESPONSE_STATUS_OK = 0;
private SolrServer server;

    public boolean remove(final Integer titleInstanceId)
    throws IOException
    {
        try {
            server.deleteById(String.valueOf(titleInstanceId));
            final UpdateResponse updateResponse = server.commit(true, true);
            // XXX It's always OK
            return (updateResponse.getStatus() == RESPONSE_STATUS_OK);

Any ideas what's going wrong? Is there a different way to test for the id
not having been there, other than an additional search?

Thanks
Reuben

Reply via email to