You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by rajashekar <ra...@yahoo.in> on 2012/12/06 08:00:52 UTC

Delete documents base on more than one condition?

Hi 

Is it possible to delete a set of documents where they match certain 
conditions? I would like to delete a set of articles that belong to a 
given user within a category. 

Thanks, 



-----




--
View this message in context: http://lucene.472066.n3.nabble.com/Delete-documents-base-on-more-than-one-condition-tp4024714.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Delete documents base on more than one condition?

Posted by Ian Lea <ia...@gmail.com>.
Or, easier, just pass the Query identifying the docs to
IndexWriter.deleteDocuments(Query query).  There are variants that
take multiple queries and single or multiple terms.  See the javadocs.


You can't delete docs via IndexReader any more.


--
Ian.


On Thu, Dec 6, 2012 at 9:19 AM, parnab kumar <pa...@gmail.com> wrote:
> Hi Rajashekhar,
>
> yet it is possible . You can form a Boolean Query which will match the
> documents as per your required conditions . Then you can delete by the
> respective document ids by instantiating a indexReader.
>
> You can refer to Book Lucene in Action 2nd Edition for more details .
>
> Thanks,
> Parnab
> IIT Kharagpur,India
>
> On Thu, Dec 6, 2012 at 12:30 PM, rajashekar <ra...@yahoo.in>wrote:
>
>> Hi
>>
>> Is it possible to delete a set of documents where they match certain
>> conditions? I would like to delete a set of articles that belong to a
>> given user within a category.
>>
>> Thanks,
>>
>>
>>
>> -----
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Delete-documents-base-on-more-than-one-condition-tp4024714.html
>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Delete documents base on more than one condition?

Posted by parnab kumar <pa...@gmail.com>.
Hi Rajashekhar,

yet it is possible . You can form a Boolean Query which will match the
documents as per your required conditions . Then you can delete by the
respective document ids by instantiating a indexReader.

You can refer to Book Lucene in Action 2nd Edition for more details .

Thanks,
Parnab
IIT Kharagpur,India

On Thu, Dec 6, 2012 at 12:30 PM, rajashekar <ra...@yahoo.in>wrote:

> Hi
>
> Is it possible to delete a set of documents where they match certain
> conditions? I would like to delete a set of articles that belong to a
> given user within a category.
>
> Thanks,
>
>
>
> -----
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Delete-documents-base-on-more-than-one-condition-tp4024714.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>