lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index FilterIndexReader.java IndexReader.java SegmentReader.java SegmentsReader.java
Date Tue, 21 Oct 2003 18:24:23 GMT
cutting     2003/10/21 11:24:23

  Modified:    .        CHANGES.txt
               src/java/org/apache/lucene/index FilterIndexReader.java
                        IndexReader.java SegmentReader.java
                        SegmentsReader.java
  Log:
  Add IndexReader.undeleteAll().
  
  Revision  Changes    Path
  1.56      +4 -1      jakarta-lucene/CHANGES.txt
  
  Index: CHANGES.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/CHANGES.txt,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- CHANGES.txt	21 Oct 2003 17:59:16 -0000	1.55
  +++ CHANGES.txt	21 Oct 2003 18:24:22 -0000	1.56
  @@ -52,6 +52,9 @@
       stop most OutOfMemoryExceptions by prefix, wildcard and fuzzy
       queries which run amok. (cutting)
   
  +13. Add new method: IndexReader.undeleteAll().  This undeletes all
  +    deleted documents which still remain in the index. (cutting)
  +
   
   1.3 RC1
   
  
  
  
  1.2       +1 -0      jakarta-lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
  
  Index: FilterIndexReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/FilterIndexReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FilterIndexReader.java	21 Oct 2003 17:59:16 -0000	1.1
  +++ FilterIndexReader.java	21 Oct 2003 18:24:23 -0000	1.2
  @@ -124,6 +124,7 @@
   
     public boolean isDeleted(int n) { return in.isDeleted(n); }
     public boolean hasDeletions() { return in.hasDeletions(); }
  +  public void undeleteAll() throws IOException { in.undeleteAll(); }
   
     public byte[] norms(String f) throws IOException { return in.norms(f); }
   
  
  
  
  1.22      +4 -1      jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java
  
  Index: IndexReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- IndexReader.java	21 Oct 2003 17:59:16 -0000	1.21
  +++ IndexReader.java	21 Oct 2003 18:24:23 -0000	1.22
  @@ -318,6 +318,9 @@
       return n;
     }
   
  +  /** Undeletes all documents currently marked as deleted in this index.*/
  +  public abstract void undeleteAll() throws IOException;
  +
     /**
      * Closes files associated with this index.
      * Also saves any new deletions to disk.
  
  
  
  1.15      +18 -1     jakarta-lucene/src/java/org/apache/lucene/index/SegmentReader.java
  
  Index: SegmentReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/SegmentReader.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SegmentReader.java	21 Oct 2003 17:59:16 -0000	1.14
  +++ SegmentReader.java	21 Oct 2003 18:24:23 -0000	1.15
  @@ -185,6 +185,23 @@
       deletedDocs.set(docNum);
     }
   
  +  public void undeleteAll() throws IOException {
  +    synchronized (directory()) {		  // in- & inter-process sync
  +      new Lock.With(directory().makeLock(IndexWriter.COMMIT_LOCK_NAME),
  +                    IndexWriter.COMMIT_LOCK_TIMEOUT) {
  +        public Object doBody() throws IOException {
  +          if (directory().fileExists(segment + ".del")) {
  +            directory().deleteFile(segment + ".del");
  +          }
  +          return null;
  +        }
  +      };
  +      deletedDocs = null;
  +      deletedDocsDirty = false;
  +    }
  +  }
  +
  +
     final Vector files() throws IOException {
       Vector files = new Vector(16);
       final String ext[] = new String[] {
  
  
  
  1.14      +6 -1      jakarta-lucene/src/java/org/apache/lucene/index/SegmentsReader.java
  
  Index: SegmentsReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/SegmentsReader.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SegmentsReader.java	21 Oct 2003 17:59:16 -0000	1.13
  +++ SegmentsReader.java	21 Oct 2003 18:24:23 -0000	1.14
  @@ -125,6 +125,11 @@
       hasDeletions = true;
     }
   
  +  public void undeleteAll() throws IOException {
  +    for (int i = 0; i < readers.length; i++)
  +      readers[i].undeleteAll();
  +  }
  +
     private final int readerIndex(int n) {	  // find reader for doc n:
       int lo = 0;					  // search starts array
       int hi = readers.length - 1;                  // for first element less
  
  
  

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


Mime
View raw message