I think you could also delete by Query (using IndexWriter), concocting
a single large query that's something like MatchAllDocsQuery AND NOT
(Q1 OR Q2 OR Q3...) where Q1, Q2, Q3 are the queries that identify the
docs you want to keep.

Mike

On Wed, Jul 22, 2009 at 10:58 PM, Anuj Bhatt<anuj.bh...@gmail.com> wrote:
> Hi,
>
> I'm relatively new to Lucene. I have the following case: I have
> indexed a bunch of documents. I then, query the index using
> IndexSearcher and retrieve the documents using Hits (I do know this is
> deprecated -- I'm using v 2.4.1). So, I do this for a set of queries
> and maintain which documents are returned to each one. In the end of
> it all, I have a list of documents maintained (more specifically, the
> hits.id(some_iterator_int) associated with the doc). Now, I wish to
> delete the documents which have not been returned for any query, from
> the index. How can I do this?
>
> My initial assumption was that I could retrieve all the doc ids from
> IndexReader and just traverse the list that I have maintained, if it
> is in the list, I don't delete it otherwise I do. Looking around
> didn't yield anything, and hence the mail.
>
>
> Any suggestions?
>
>
> Regards,
> Anuj
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

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

Reply via email to