jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r721470 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene: AbstractIndex.java MultiIndex.java SearchIndex.java
Date Fri, 28 Nov 2008 13:16:18 GMT
Author: mreutegg
Date: Fri Nov 28 05:16:17 2008
New Revision: 721470

URL: http://svn.apache.org/viewvc?rev=721470&view=rev
Log:
JCR-1885: Make termInfosIndexDivisor configurable

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java?rev=721470&r1=721469&r2=721470&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractIndex.java
Fri Nov 28 05:16:17 2008
@@ -92,6 +92,9 @@
     /** maxFieldLength config parameter */
     private int maxFieldLength = SearchIndex.DEFAULT_MAX_FIELD_LENGTH;
 
+    /** termInfosIndexDivisor config parameter */
+    private int termInfosIndexDivisor = SearchIndex.DEFAULT_MIN_MERGE_DOCS;
+
     /**
      * The document number cache if this index may use one.
      */
@@ -245,7 +248,9 @@
             indexWriter = null;
         }
         if (indexReader == null) {
-            indexReader = new CommittableIndexReader(IndexReader.open(getDirectory()));
+            IndexReader reader = IndexReader.open(getDirectory());
+            reader.setTermInfosIndexDivisor(termInfosIndexDivisor);
+            indexReader = new CommittableIndexReader(reader);
         }
         return indexReader;
     }
@@ -295,7 +300,9 @@
         }
         if (sharedReader == null) {
             // create new shared reader
-            CachingIndexReader cr = new CachingIndexReader(IndexReader.open(getDirectory()),
cache);
+            IndexReader reader = IndexReader.open(getDirectory());
+            reader.setTermInfosIndexDivisor(termInfosIndexDivisor);
+            CachingIndexReader cr = new CachingIndexReader(reader, cache);
             sharedReader = new SharedIndexReader(cr);
         }
         readOnlyReader = new ReadOnlyIndexReader(sharedReader, deleted, modCount);
@@ -548,6 +555,22 @@
         }
     }
 
+    /**
+     * @return the current value for termInfosIndexDivisor.
+     */
+    public int getTermInfosIndexDivisor() {
+        return termInfosIndexDivisor;
+    }
+
+    /**
+     * Sets a new value for termInfosIndexDivisor.
+     *
+     * @param termInfosIndexDivisor the new value.
+     */
+    public void setTermInfosIndexDivisor(int termInfosIndexDivisor) {
+        this.termInfosIndexDivisor = termInfosIndexDivisor;
+    }
+
     //------------------------------< internal >--------------------------------
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=721470&r1=721469&r2=721470&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
Fri Nov 28 05:16:17 2008
@@ -269,6 +269,7 @@
             index.setMinMergeDocs(handler.getMinMergeDocs());
             index.setMaxFieldLength(handler.getMaxFieldLength());
             index.setUseCompoundFile(handler.getUseCompoundFile());
+            index.setTermInfosIndexDivisor(handler.getTermInfosIndexDivisor());
             indexes.add(index);
             merger.indexAdded(index.getName(), index.getNumDocuments());
         }
@@ -574,6 +575,7 @@
         index.setMinMergeDocs(handler.getMinMergeDocs());
         index.setMaxFieldLength(handler.getMaxFieldLength());
         index.setUseCompoundFile(handler.getUseCompoundFile());
+        index.setTermInfosIndexDivisor(handler.getTermInfosIndexDivisor());
 
         // add to list of open indexes and return it
         indexes.add(index);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=721470&r1=721469&r2=721470&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Fri Nov 28 05:16:17 2008
@@ -159,6 +159,11 @@
     public static final long DEFAULT_EXTRACTOR_TIMEOUT = 100;
 
     /**
+     * The default value for {@link #termInfosIndexDivisor}.
+     */
+    public static final int DEFAULT_TERM_INFOS_INDEX_DIVISOR = 1;
+
+    /**
      * The path of the root node.
      */
     private static final Path ROOT_PATH;
@@ -417,6 +422,11 @@
     private DirectoryManager directoryManager;
 
     /**
+     * The termInfosIndexDivisor.
+     */
+    private int termInfosIndexDivisor = DEFAULT_TERM_INFOS_INDEX_DIVISOR;
+
+    /**
      * Indicates if this <code>SearchIndex</code> is closed and cannot be used
      * anymore.
      */
@@ -1958,6 +1968,22 @@
         this.directoryManagerClass = className;
     }
 
+    /**
+     * @return the current value for termInfosIndexDivisor.
+     */
+    public int getTermInfosIndexDivisor() {
+        return termInfosIndexDivisor;
+    }
+
+    /**
+     * Sets a new value for termInfosIndexDivisor.
+     *
+     * @param termInfosIndexDivisor the new value.
+     */
+    public void setTermInfosIndexDivisor(int termInfosIndexDivisor) {
+        this.termInfosIndexDivisor = termInfosIndexDivisor;
+    }
+
     //----------------------------< internal >----------------------------------
 
     /**



Mime
View raw message