this code works in a couple other boxes as is.    that deleting code removes 
the active index after this one builds in a different location.   then the 
searcher is told to make this newest one the current and the old one is 
deleted.     it effects directories and their entire contents.  it wouldnt 
select just a segment file.     also, like i said, this runs fine on my laptop 
and g5.   and actually, this code was fine till recently on that box.  i 
modified a different method and updated the code to this server and now i have 
this problem.    

i noticed the segments file has some nonreadable stuff in there... i can't just 
make an empty one in the directory can i?   even if i do, i dont want to put a 
slopy work around like that in..    


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Chris Hostetter
Sent: Fri 1/27/2006 7:00 PM
To: java-user@lucene.apache.org
Subject: RE: problem updating a document: no segments file?
 

: Its still not keeping the segments file around.     Is that necessary?

You seem to have some code at the end that (i'm guess) is supposed to
remove older copies of the index.  Are you sure that code does what you
think it does?  Have you tried commenting it out and seeing if that fixes
your problem?  There may be a bug in that code (I didn't read it that
closely) ...


:           String newPath = getIndexLocation() + File.separator +
: System.currentTimeMillis();
:
:           IndexWriter writer = new IndexWriter(new File(newPath),
: analyzer, true);

        ...

:         writer.optimize();
:         writer.close();
:
:       SearchSO.setSearcher(newPath);
:
:       File[] subFiles;
:       File[] subDirs = new File(getIndexLocation()).listFiles();
:
:       for (int i=0;i<subDirs.length;i++) {
:               if (subDirs[i].isDirectory()) {
:                       if (!newPath.equals(subDirs[i].getPath())) {
:                               subFiles = subDirs[i].listFiles();
:                               for (int j=0;j<subFiles.length;j++) {
:                                       subFiles[j].delete();
:                               }
:                               subDirs[i].delete();
:                       }
:               }
:       }
:
:
:     }


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to