lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derya Kasapoglu" <doz...@gmx.de>
Subject Re: UpdateIndex
Date Tue, 23 Aug 2005 10:38:06 GMT
Hi,

i'm writing the deletion now and i do it that way:

i query the index for the path of the files in the directory and compare the
dates.
But i have a Problem!
I find out the files which have changed but i can not delete the documet
from the index, i don't know why!

In the Field "pathLC" is he path of documnts in lower case.
Term term = new Term("pathLC", file[i].getAbsolutePath().toLowerCase());
delete(Term);

Than i close the IndexReader!!!

But i can still searching for the file which sould be deleted.

Derya



> --- Ursprüngliche Nachricht ---
> Von: Ray Tsang <saturnism@gmail.com>
 An: java-user@lucene.apache.org
 Betreff: Re: UpdateIndex
> Datum: Tue, 23 Aug 2005 09:48:59 +0800
> 
> This could be off topic, but I made something that updates indices
> that worked like the following, wonder if anybody has the same ideas? 
> I found something like IndexAccessControl in the mailing list before. 
> An implementation of the following uses IAC.
> 
> ManagedIndex index = ManagedIndex.getInstance(configuration); // could
> return different implemetnations of the ManagedIndex
> 
> Searcher searcher = index.getSearcher();  // could return different
> implementations of Searcher
> 
> ManagedUpdateSession session = index.beginUpdate();  // start a update
> session
> 
> session.addDocument(...); // use session to add, delete, update documents
> session.deleteDocument(...);
> session.updateDocument(...);
> 
> // lastly
> index.endUpdate(); // or.. session.commit()?  marks the end of the
> update sequence, refresh the searchers.
> 
> IndexReader, IndexWriter, indexSearcher would be managed, and there
> can be multiple implementations of how index is structured, e.g.
> RotatingIndex, AlternatingIndex, that rotates document updates to
> different indices.
> 
> Ray,
> 
> On 8/23/05, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> > Yes, this is not how you should do it.
> > Use reader.delete(Term) method to delete documents:
> >
>
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#delete(org.apache.lucene.index.Term)
> > 
> > Otis
> > 
> > --- dozean@gmx.de wrote:
> > 
> > > Hi,
> > >
> > > i wrote an Index update, where first the IndexReader
> > > delete all files from index which are changed.
> > > Than add documents which are not in the index!
> > >
> > > Alone the deletion take so long, because i have 2 "for" loops!
> > >
> > > file = array with all files in a directory
> > >
> > > for (int i = 0; i<file.length; i++) {
> > >       if (file[i].isFile()) {
> > >    for (int j =0; j<reader.numDocs(); j++) {
> > >       if (file[i].getName() == reader.document(j).get("name") &&
> > >       file[i].lastModified() >
> > > Integer.parseInt(reader.document(j).get("date")))
> > > {                                             reader.delete(j);
> > >      }
> > > }
> > >
> > > Maybe this is the wrong way?
> > >
> > > Bye Derya
> > >
> > >
> > > --
> > > 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
> > > +++ GMX - die erste Adresse für Mail, Message, More +++
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++

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


Mime
View raw message