You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ramzesua <mi...@gmail.com> on 2012/06/18 11:45:57 UTC
delete by query don't work
Hi all. I am using solr 4.0 and trying to clear index by query. At first I
use <delete><query>*:*</query></delete> with commit, but index is still not
empty. I tried another queries, but it not help me. Then I tried delete by
`id`. It works fine, but I need clear all index. Can anyone help me?
--
View this message in context: http://lucene.472066.n3.nabble.com/delete-by-query-don-t-work-tp3990077.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: delete by query don't work
Posted by vidhya <vi...@gmail.com>.
In order to clear all the indexed data please try to use this code
private void Btn_Delete_Click(object sender, EventArgs e)
{
var solrUrl = this.textBoxSolrUrl.Text;
indexer.FixtureSetup(solrUrl);
indexer.Delete();
MessageBox.Show("Delete of files is completed");
}
public void Delete()
{
var solr =
ServiceLocator.Current.GetInstance<ISolrOperations<Document>>();
solr.Delete(new SolrQueryByField("id", "*:*"));
solr.Commit();
}
Use this code to delete indivisual document
solr.Delete(new SolrQueryByField("id", "SP2514N"));
Here particular id="SP2514N" will be removed from the Indexed data.
--
View this message in context: http://lucene.472066.n3.nabble.com/delete-by-query-don-t-work-tp3990077p3990243.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: delete by query don't work
Posted by Toke Eskildsen <te...@statsbiblioteket.dk>.
On Mon, 2012-06-18 at 11:45 +0200, ramzesua wrote:
> Hi all. I am using solr 4.0 and trying to clear index by query. At first I
> use <delete><query>*:*</query></delete> with commit, but index is still not
> empty. I tried another queries, but it not help me. Then I tried delete by
> `id`. It works fine, but I need clear all index. Can anyone help me?
It's a subtle bug/problem in the default schema. Fortunately it is
easily fixable. See https://issues.apache.org/jira/browse/SOLR-3432
Re: delete by query don't work
Posted by Erick Erickson <er...@gmail.com>.
Well, it would help if you defined what behavior you're seeing. When you
say delete-by-query doesn't work, what is the symptom? What does "empty"
mean? Because if you're just looking at your index directory and expecting
to see files disappear, you'll be disappointed.
When you delete documents in Solr, the docs are just marked as deleted, they
aren't physically removed until segments are merged. Does a query for *:* return
any documents after you delete-by-query?
Running an optimize after you do the delete will force merging to happen BTW.
If this doesn't help, please post the exact URLs you use, and what
your evidence that
"the index isn't empty" is.
Best
Erick
On Mon, Jun 18, 2012 at 5:45 AM, ramzesua <mi...@gmail.com> wrote:
> Hi all. I am using solr 4.0 and trying to clear index by query. At first I
> use <delete><query>*:*</query></delete> with commit, but index is still not
> empty. I tried another queries, but it not help me. Then I tried delete by
> `id`. It works fine, but I need clear all index. Can anyone help me?
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/delete-by-query-don-t-work-tp3990077.html
> Sent from the Solr - User mailing list archive at Nabble.com.