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 Jeff Zhang <zj...@gmail.com> on 2011/05/02 04:04:12 UTC

Problems of deleting documents from Solr

Hi all,

I want to update some document, so first I delete these document by invoking
command "java -Ddata=args -Dcommit=yes -jar post.jar
"<delete><cat>monitor</cat></delete>"
The result is that I can not search the deleted documents but I can still
see the terms of these document in
http://localhost:8983/solr/admin/schema.jsp
Even when I restart solr, it's still there, I notice that the *numDocs: * 0
while *maxDoc: * 1

Why's that ? How can I delete the documents correctly ?

-- 
Best Regards

Jeff Zhang

Re: Problems of deleting documents from Solr

Posted by Ahmet Arslan <io...@yahoo.com>.
Hi Jeff,

You canĀ  delete either by unique id or by a query.
It seems that you want to delete all documents having category of monitor.

<delete><query>cat:monitor</query></delete>

http://wiki.apache.org/solr/UpdateXmlMessages#A.22delete.22_by_ID_and_by_Query


----- Original Message -----
From: Jeff Zhang <zj...@gmail.com>
To: solr-user@lucene.apache.org
Cc: 
Sent: Monday, May 2, 2011 5:04 AM
Subject: Problems of deleting documents from Solr

Hi all,

I want to update some document, so first I delete these document by invoking
command "java -Ddata=args -Dcommit=yes -jar post.jar
"<delete><cat>monitor</cat></delete>"
The result is that I can not search the deleted documents but I can still
see the terms of these document in
http://localhost:8983/solr/admin/schema.jsp
Even when I restart solr, it's still there, I notice that the *numDocs: * 0
while *maxDoc: * 1

Why's that ? How can I delete the documents correctly ?

-- 
Best Regards

Jeff Zhang


Re: Problems of deleting documents from Solr

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi Jeff,

If you run the optimize command after deletion, all documents marked as deleted 
will be expunged from the index.

Keep in mind that another way to update a document is to just re-add it with the 
new values.  If you use uniqueKey (defined in schema.xml), Solr will make sure 
there are no duplicates in the index.

Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/



----- Original Message ----
> From: Jeff Zhang <zj...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Sun, May 1, 2011 10:04:12 PM
> Subject: Problems of deleting documents from Solr
> 
> Hi all,
> 
> I want to update some document, so first I delete these document  by invoking
> command "java -Ddata=args -Dcommit=yes -jar  post.jar
> "<delete><cat>monitor</cat></delete>"
> The  result is that I can not search the deleted documents but I can still
> see the  terms of these document in
> http://localhost:8983/solr/admin/schema.jsp
> Even when I restart solr,  it's still there, I notice that the *numDocs: * 0
> while *maxDoc: *  1
> 
> Why's that ? How can I delete the documents correctly ?
> 
> -- 
> Best Regards
> 
> Jeff Zhang
>