List of usage examples for org.apache.solr.client.solrj SolrClient deleteByQuery
public UpdateResponse deleteByQuery(String query) throws SolrServerException, IOException
From source file:org.opencms.search.solr.spellchecking.CmsSpellcheckDictionaryIndexer.java
License:Open Source License
/** * Deletes a single document from the Solr client.<p> * * @param client The SolrClient instance object. * @param lang The affected language./*www . j a v a 2s .c om*/ * @param word The word that should be removed. * * @throws IOException in case something goes wrong * @throws SolrServerException in case something goes wrong */ static void deleteDocument(SolrClient client, String lang, String word) throws IOException, SolrServerException { if ((null == client) || CmsStringUtil.isEmptyOrWhitespaceOnly(lang) || CmsStringUtil.isEmptyOrWhitespaceOnly(word)) { return; } // Make sure the parameter holding the word that should be deleted // contains just a single word if (word.trim().contains(" ")) { final String query = String.format("entry_%s:%s", lang, word); client.deleteByQuery(query); } }