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 "Kashyap, Raghu" <Ra...@orbitz.com> on 2008/09/19 23:19:17 UTC

deleting record from the index using deleteByQuery method

Hi,

 

 I am trying to delete a record from the index using SolrJ. When I
execute it I get a status of 0 which means success. I see that the
"cummulative_deletbyquery" count increases by 1 and also the "commit"
count increases by one. I don't see any decrease on the "numDocs" count.
When I query it back I do see that record again. 

 

 

        //rev.id is the field within the solr document that identifies
that review

        String deleteQuery = "rev.id:" + reviewId;

 

        SolrServer solrServer = new CommonsHttpSolrServer(indexUrl);

 

        UpdateResponse solrResponse =
solrServer.deleteByQuery(deleteQuery);

        solrResponse = solrServer.commit();

 

Appreciate your response.

 

Thanks,

Raghu


Re: Solr 1.3 does not recognize Solr home...

Posted by Ryan McKinley <ry...@gmail.com>.
>
> I have temporarily solved the problem by hardcoding the folders in the
> <dataDir> element like so:
>
> <dataDir>C:\tomcatweb\merchant\data</dataDir>   (in the  
> solrconfig.xml)
>
> Any ideas of what I am doing wrong?
>

Is it solr home or or the data directory that is getting set wrong?

I *think* the difference is that with 1.2, you could not use  
properties to set the dataDir, it was hardcoded to "/data/" relative  
to your solr home.

In 1.3, the example comes with a default property ${data.dir:./data}  
(or something like that

If you remove the <dataDir> element altogether, it should go back to  
1.2 behavior...

ryan


Solr 1.3 does not recognize Solr home...

Posted by William Pierce <ev...@hotmail.com>.
Folks:

I have an odd situation that I am hoping someone can shed light on.

I have a solr apps running under tomcat 6.0.14 (on a windows xp sp3 
machine).
The app is declared in the tomcat config file as follows:

In file "merchant.xml" for the "merchant" app:

<Context docBase="c:\apache-tomcat-6.0.14\lib\solr.war" debug="0"
crossContext="true" >
   <Environment name="solr/home" type="java.lang.String"
value="c:\tomcatweb\merchant" override="true" />
</Context>

I have of course created the folders:  c:\tomcatweb\merchant under which you 
can find the "data", "conf" and
"bin" folders.

Now this configuration worked with 1.2.  It also worked with the 1.3
solr.war but still using the older 1.2 config files that I have been using.

The problem comes when I use the 1.3 solr.war and use the new 1.3
solrconfig.xml files.  I used as a base the config files found in the
"example" folder of the 1.3 bits I downloaded.  I then modified these files
by including
the various fields, field types, and the request handler definitions, etc
that are particular to my configuration.

When I start up tomcat,  I notice that the home directory is set to
"Windows\system32\solr" and the requisite index files are being created
under that.

I have temporarily solved the problem by hardcoding the folders in the
<dataDir> element like so:

<dataDir>C:\tomcatweb\merchant\data</dataDir>   (in the solrconfig.xml)

Any ideas of what I am doing wrong?

 


Solr Using

Posted by Dinesh Gupta <di...@hotmail.com>.

Hi All,

I am new to Solr. I am using Lucene last 2 years.

We create Lucene indexes for database.

Please help to migrate to Solr.

How can achieve this.

If any one have idea, please help.

Thanks In Advance.


Regards,
Dinesh Gupta

_________________________________________________________________
Search for videos of Bollywood, Hollywood, Mollywood and every other wood, only on Live.com 
http://www.live.com/?scope=video&form=MICOAL

RE: deleting record from the index using deleteByQuery method

Posted by Chris Hostetter <ho...@fucit.org>.
: confused about is the field cumulative_delete. Does this have any
: significance to whether the delete was a success or not? Also shouldn't

cumulative_delete is just the count of all delete commands since the 
SolreCore was started up (as opposed to "delete" which is the count since 
the last commit)

: the method deleteByQuery return a diff status code based on if the
: delete was successful or not?

I'm not certain, but i don't think so -- consider a query for 
"asdflkakjadf" ... if there are no docs that match that query, then no 
docs get deleted -- but the operation is still successful (just like a 
search is still a success even if no docs are found)



-Hoss


RE: deleting record from the index using deleteByQuery method

Posted by "Kashyap, Raghu" <Ra...@orbitz.com>.
Thanks for your response Chris.

I do see the reviewid in the index through luke. I guess what I am
confused about is the field cumulative_delete. Does this have any
significance to whether the delete was a success or not? Also shouldn't
the method deleteByQuery return a diff status code based on if the
delete was successful or not?

-Raghu 


-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org] 
Sent: Monday, September 22, 2008 11:30 PM
To: solr-user@lucene.apache.org
Subject: Re: deleting record from the index using deleteByQuery method


:  I am trying to delete a record from the index using SolrJ. When I
: execute it I get a status of 0 which means success. I see that the
: "cummulative_deletbyquery" count increases by 1 and also the "commit"
: count increases by one. I don't see any decrease on the "numDocs"
count.
: When I query it back I do see that record again. 

I'm not positive, but i don't think deleting by query will error if no 
documents matched the query -- so just because it succeeds doesn't mean
it 
actually deleted anything ... are you sure '"rev.id:" + reviewId'
matches 
on the document you are trying to delete?  does that search find it
using 
the default handler?  (is there any analyzer weirdness?)



-Hoss

If you are not the intended recipient of this e-mail message, please notify the sender 
and delete all copies immediately. The sender believes this message and any attachments 
were sent free of any virus, worm, Trojan horse, and other forms of malicious code. 
This message and its attachments could have been infected during transmission. The 
recipient opens any attachments at the recipient's own risk, and in so doing, the 
recipient accepts full responsibility for such actions and agrees to take protective 
and remedial action relating to any malicious code. Travelport is not liable for any 
loss or damage arising from this message or its attachments.



Re: deleting record from the index using deleteByQuery method

Posted by Chris Hostetter <ho...@fucit.org>.
:  I am trying to delete a record from the index using SolrJ. When I
: execute it I get a status of 0 which means success. I see that the
: "cummulative_deletbyquery" count increases by 1 and also the "commit"
: count increases by one. I don't see any decrease on the "numDocs" count.
: When I query it back I do see that record again. 

I'm not positive, but i don't think deleting by query will error if no 
documents matched the query -- so just because it succeeds doesn't mean it 
actually deleted anything ... are you sure '"rev.id:" + reviewId' matches 
on the document you are trying to delete?  does that search find it using 
the default handler?  (is there any analyzer weirdness?)



-Hoss