You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by ot...@apache.org on 2008/05/22 08:47:37 UTC

svn commit: r659021 - in /lucene/java/trunk: CHANGES.txt contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java

Author: otis
Date: Wed May 21 23:47:36 2008
New Revision: 659021

URL: http://svn.apache.org/viewvc?rev=659021&view=rev
Log:
LUCENE-852: Let the SpellChecker caller specify IndexWriter mergeFactor and RAM buffer size.

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=659021&r1=659020&r2=659021&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed May 21 23:47:36 2008
@@ -64,6 +64,9 @@
     replacement character U+FFFD.  This is a change to the index file
     format.  (Marvin Humphrey via Mike McCandless)
 
+ 8. LUCENE-852: Let the SpellChecker caller specify IndexWriter mergeFactor
+    and RAM buffer size.  (Otis Gospodnetic)
+
 Bug fixes
     
  1. LUCENE-1134: Fixed BooleanQuery.rewrite to only optimize a single 

Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=659021&r1=659020&r2=659021&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java (original)
+++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java Wed May 21 23:47:36 2008
@@ -303,14 +303,16 @@
   }
 
   /**
-   * Index a Dictionary
-   * @param dict the dictionary to index
+   * Indexes the data from the given {@link Dictionary}.
+   * @param dict Dictionary to index
+   * @param mergeFactor mergeFactor to use when indexing
+   * @param ramMB the max amount or memory in MB to use
    * @throws IOException
    */
-  public void indexDictionary(Dictionary dict) throws IOException {
+  public void indexDictionary(Dictionary dict, int mergeFactor, int ramMB) throws IOException {
     IndexWriter writer = new IndexWriter(spellIndex, true, new WhitespaceAnalyzer());
-    writer.setMergeFactor(300);
-    writer.setMaxBufferedDocs(150);
+    writer.setMergeFactor(mergeFactor);
+    writer.setRAMBufferSizeMB(ramMB);
 
     Iterator iter = dict.getWordsIterator();
     while (iter.hasNext()) {
@@ -338,6 +340,15 @@
     searcher = new IndexSearcher(this.spellIndex);
   }
 
+  /**
+   * Indexes the data from the given {@link Dictionary}.
+   * @param dict the dictionary to index
+   * @throws IOException
+   */
+  public void indexDictionary(Dictionary dict) throws IOException {
+    indexDictionary(dict, 300, 10);
+  }
+
   private int getMin(int l) {
     if (l > 5) {
       return 3;