lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index IndexWriter.java DocumentWriter.java
Date Sun, 12 Dec 2004 20:26:27 GMT
dnaber      2004/12/12 12:26:27

  Modified:    src/java/org/apache/lucene/index IndexWriter.java
                        DocumentWriter.java
  Log:
  print a message to infoStream if the number of maximum tokens per document (maxFieldLength)
is reached
  
  Revision  Changes    Path
  1.44      +3 -1      jakarta-lucene/src/java/org/apache/lucene/index/IndexWriter.java
  
  Index: IndexWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/IndexWriter.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- IndexWriter.java	29 Nov 2004 20:41:01 -0000	1.43
  +++ IndexWriter.java	12 Dec 2004 20:26:27 -0000	1.44
  @@ -321,7 +321,8 @@
       return mergeFactor;
     }
   
  -  /** If non-null, information about merges will be printed to this.
  +  /** If non-null, information about merges and a message when
  +   * maxFieldLength is reached will be printed to this.
      */
     public void setInfoStream(PrintStream infoStream) {
       this.infoStream = infoStream;
  @@ -404,6 +405,7 @@
     public void addDocument(Document doc, Analyzer analyzer) throws IOException {
       DocumentWriter dw =
         new DocumentWriter(ramDirectory, analyzer, similarity, maxFieldLength);
  +    dw.setInfoStream(infoStream);
       String segmentName = newSegmentName();
       dw.addDocument(segmentName, doc);
       synchronized (this) {
  
  
  
  1.15      +13 -1     jakarta-lucene/src/java/org/apache/lucene/index/DocumentWriter.java
  
  Index: DocumentWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/DocumentWriter.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DocumentWriter.java	5 Oct 2004 17:30:47 -0000	1.14
  +++ DocumentWriter.java	12 Dec 2004 20:26:27 -0000	1.15
  @@ -17,6 +17,7 @@
    */
   
   import java.io.IOException;
  +import java.io.PrintStream;
   import java.io.Reader;
   import java.io.StringReader;
   import java.util.Hashtable;
  @@ -38,6 +39,7 @@
     private Similarity similarity;
     private FieldInfos fieldInfos;
     private int maxFieldLength;
  +  private PrintStream infoStream;
   
     /**
      * 
  @@ -159,8 +161,11 @@
                   addPosition(fieldName, t.termText(), position++, null);
                 
                 lastToken = t;
  -              if (++length > maxFieldLength) 
  +              if (++length > maxFieldLength) {
  +                if (infoStream != null)
  +                  infoStream.println("maxFieldLength " +maxFieldLength+ " reached, ignoring
following tokens");
                   break;
  +              }
               }
               
               if(lastToken != null)
  @@ -367,6 +372,13 @@
         }
       }
     }
  +  
  +  /** If non-null, a message will be printed to this if maxFieldLength is reached.
  +   */
  +  void setInfoStream(PrintStream infoStream) {
  +    this.infoStream = infoStream;
  +  }
  +
   }
   
   final class Posting {				  // info about a Term in a doc
  
  
  

---------------------------------------------------------------------
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