ibm-watsonretrieve-and-rank

Delete document from watson rank and retrieve


I've created a watson rank and retrieve collection. I was able to add a document and I can search it, but it was a test document. How do I delete it?

This is what I want to delete:

// add a document
var doc = { id : 1234, title_t : 'Hello', text_field_s: 'some text' };
solrClient.add(doc, function(err) {
  if(err) {
    console.log('Error indexing document: ' + err);
  } else {
    console.log('Indexed a document.');
    solrClient.commit(function(err) {
      if(err) {
        console.log('Error committing change: ' + err);
      } else {
        console.log('Successfully commited changes.');
      }
    });
  }
});

Solution

  • solrClient.deleteByID(1234, function(err) {
        solrClient.commit(function (err) {
            // obviously add error-handling
        });
    });