lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/store Lock.java
Date Thu, 18 Mar 2004 19:05:18 GMT
otis        2004/03/18 11:05:18

  Modified:    .        CHANGES.txt
               src/java/org/apache/lucene/index IndexWriter.java
               src/java/org/apache/lucene/search BooleanQuery.java
               src/java/org/apache/lucene/store Lock.java
  Log:
  - Added support for setting various Lucene properties via system properties.
  
  Revision  Changes    Path
  1.76      +11 -1     jakarta-lucene/CHANGES.txt
  
  Index: CHANGES.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/CHANGES.txt,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- CHANGES.txt	3 Mar 2004 11:24:48 -0000	1.75
  +++ CHANGES.txt	18 Mar 2004 19:05:18 -0000	1.76
  @@ -61,6 +61,16 @@
       strings: http://issues.apache.org/bugzilla/show_bug.cgi?id=24665
       (Jean-Francois Halleux via Otis)
   
  +12. Added support for overriding default values for the following,
  +    using system properties:
  +      - default commit lock timeout
  +      - default maxFieldLength
  +      - default maxMergeDocs
  +      - default mergeFactor
  +      - default minMergeDocs
  +      - default write lock timeout
  +    (Otis)
  +
   
   1.3 final
   
  
  
  
  1.24      +25 -8     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- IndexWriter.java	4 Mar 2004 14:31:53 -0000	1.23
  +++ IndexWriter.java	18 Mar 2004 19:05:18 -0000	1.24
  @@ -49,14 +49,31 @@
     */
   
   public class IndexWriter {
  -  public static long WRITE_LOCK_TIMEOUT = 1000;
  -  public static long COMMIT_LOCK_TIMEOUT = 10000;
  +  public static long WRITE_LOCK_TIMEOUT =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.writeLockTimeout",
  +      "1000"));
  +  public static long COMMIT_LOCK_TIMEOUT =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.commitLockTimeout",
  +      "10000"));
   
     public static final String WRITE_LOCK_NAME = "write.lock";
     public static final String COMMIT_LOCK_NAME = "commit.lock";
   
  -  private Directory directory;			  // where this index resides
  -  private Analyzer analyzer;			  // how to analyze text
  +  private static final int DEFAULT_MERGE_FACTOR =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.mergeFactor",
  +      "10"));
  +  private static final int DEFAULT_MIN_MERGE_DOCS =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.minMergeDocs",
  +      "10"));
  +  private static final int DEFAULT_MAX_FIELD_LENGTH =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.maxFieldLength",
  +      "10000"));
  +  private static final int DEFAULT_MAX_MERGE_DOCS =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.maxMergeDocs",
  +      String.valueOf(Integer.MAX_VALUE)));
  +
  +  private Directory directory;  // where this index resides
  +  private Analyzer analyzer;    // how to analyze text
   
     private Similarity similarity = Similarity.getDefault(); // how to normalize
   
  @@ -228,7 +245,7 @@
      * is your memory, but you should anticipate an OutOfMemoryError.<p/>
      * By default, no more than 10,000 terms will be indexed for a field.
     */
  -  public int maxFieldLength = 10000;
  +  public int maxFieldLength = DEFAULT_MAX_FIELD_LENGTH;
   
     /**
      * Adds a document to this index.  If the document contains more than
  @@ -269,7 +286,7 @@
      * interactively maintained.
      *
      * <p>This must never be less than 2.  The default value is 10.*/
  -  public int mergeFactor = 10;
  +  public int mergeFactor = DEFAULT_MERGE_FACTOR;
   
     /** Determines the minimal number of documents required before the buffered
      * in-memory documents are merging and a new Segment is created.
  @@ -278,7 +295,7 @@
      * the number of files open in a FSDirectory.
      *
      * <p> The default value is 10.*/
  -  public int minMergeDocs = 10;
  +  public int minMergeDocs = DEFAULT_MIN_MERGE_DOCS;
   
   
     /** Determines the largest number of documents ever merged by addDocument().
  @@ -287,7 +304,7 @@
      * Larger values are best for batched indexing and speedier searches.
      *
      * <p>The default value is {@link Integer#MAX_VALUE}. */
  -  public int maxMergeDocs = Integer.MAX_VALUE;
  +  public int maxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
   
     /** If non-null, information about merges will be printed to this. */
     public PrintStream infoStream = null;
  
  
  
  1.20      +6 -4      jakarta-lucene/src/java/org/apache/lucene/search/BooleanQuery.java
  
  Index: BooleanQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/BooleanQuery.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- BooleanQuery.java	6 Feb 2004 19:19:20 -0000	1.19
  +++ BooleanQuery.java	18 Mar 2004 19:05:18 -0000	1.20
  @@ -62,7 +62,9 @@
     queries, typically {@link TermQuery}s or {@link PhraseQuery}s.
     */
   public class BooleanQuery extends Query {
  -  private static int maxClauseCount = 1024;
  +  private static int maxClauseCount =
  +    Integer.parseInt(System.getProperty("org.apache.lucene.maxClauseCount",
  +      "1024"));
   
     /** Thrown when an attempt is made to add more than {@link
      * #getMaxClauseCount()} clauses. */
  @@ -107,7 +109,7 @@
     public void add(BooleanClause clause) {
       if (clauses.size() >= maxClauseCount)
         throw new TooManyClauses();
  -    
  +
       clauses.addElement(clause);
     }
   
  @@ -140,7 +142,7 @@
           if (!c.prohibited)
             sum += w.sumOfSquaredWeights();         // sum sub weights
         }
  -      
  +
         sum *= getBoost() * getBoost();             // boost each sub-weight
   
         return sum ;
  @@ -164,7 +166,7 @@
         // from a BooleanScorer are not always sorted by document number (sigh)
         // and hence BooleanScorer cannot implement skipTo() correctly, which is
         // required by ConjunctionScorer.
  -      boolean allRequired = true;      
  +      boolean allRequired = true;
         boolean noneBoolean = true;
         for (int i = 0 ; i < weights.size(); i++) {
           BooleanClause c = (BooleanClause)clauses.elementAt(i);
  
  
  
  1.6       +4 -1      jakarta-lucene/src/java/org/apache/lucene/store/Lock.java
  
  Index: Lock.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/store/Lock.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Lock.java	13 Oct 2003 14:29:47 -0000	1.5
  +++ Lock.java	18 Mar 2004 19:05:18 -0000	1.6
  @@ -74,6 +74,9 @@
   public abstract class Lock {
     public static long LOCK_POLL_INTERVAL = 1000;
       
  +  private static final String LOCK_DIR =
  +    System.getProperty("org.apache.lucene.lockdir",
  +      System.getProperty("java.io.tmpdir"));
   
     /** Attempts to obtain exclusive access and immediately return
      *  upon success or failure.
  
  
  

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