Yet another patch.

Right now there are a number of DEFAULT_ vars in IndexWriter. On init these are fetched from system properties and initialized.

One problem here though is that once the VM has been started there's no way to chnage them. I'd prefer to set these via my own initializer as we use a reflection system to set system properies and this will tie into our system much better. It would also allow someone to write their own initializer to just set org.apache.lucene.index.IndexWriter.DEFAULT_MERGE_FACTOR = .... or do this dynamically via code. (not everyone has access to system properties)

I also added a DEFAULT_ value for using the compound index writer.

Of course now let me pre-emptively respond to your inevitable replies:

1. We can't allow the values to change at runtime.

Why not?  I can set them via instance variables at anytime.

2. These are supposed to be constant variables.

They don't need to be.  Keep an open mind! ;)

I'm sure there will be a few more complaints but its late and I can't think that fast.

Another note..  Why are we obfuscating the fully qualified var name?

Instead of users setting a property of 'org.apache.lucene.mergeFactor" why not just have them set " "org.apache.lucene.index.IndexWriter.DEFAULT_MERGE_FACTOR"

Seems less complicated.........

Anyway... just some thoughts.

--- lucene-1.4.3/src/java/org/apache/lucene/index/IndexWriter.java 2004-06-24 01:05:55.000000000 -0700
+++ lucene-1.4.3-burton/src/java/org/apache/lucene/index/IndexWriter.java 2005-02-25 00:09:07.000000000 -0800
@@ -73,7 +72,7 @@
* Default value is 10. Use <code>org.apache.lucene.mergeFactor</code>
* system property to override.
*/
- public static final int DEFAULT_MERGE_FACTOR =
+ public static int DEFAULT_MERGE_FACTOR =
Integer.parseInt(System.getProperty("org.apache.lucene.mergeFactor",
"10"));


@@ -81,7 +80,7 @@
   * Default value is 10.  Use <code>org.apache.lucene.minMergeDocs</code>
   * system property to override.
   */
-  public static final int DEFAULT_MIN_MERGE_DOCS =
+  public static int DEFAULT_MIN_MERGE_DOCS =
    Integer.parseInt(System.getProperty("org.apache.lucene.minMergeDocs",
      "10"));

@@ -89,7 +88,7 @@
* Default value is [EMAIL PROTECTED] Integer#MAX_VALUE}.
* Use <code>org.apache.lucene.maxMergeDocs</code> system property to override.
*/
- public static final int DEFAULT_MAX_MERGE_DOCS =
+ public static int DEFAULT_MAX_MERGE_DOCS =
Integer.parseInt(System.getProperty("org.apache.lucene.maxMergeDocs",
String.valueOf(Integer.MAX_VALUE)));


@@ -97,10 +96,11 @@
* Default value is 10000. Use <code>org.apache.lucene.maxFieldLength</code>
* system property to override.
*/
- public static final int DEFAULT_MAX_FIELD_LENGTH =
+ public static int DEFAULT_MAX_FIELD_LENGTH =
Integer.parseInt(System.getProperty("org.apache.lucene.maxFieldLength",
"10000"));


+  public static boolean DEFAULT_USE_COMPOUND_FILE = true;

private Directory directory; // where this index resides
private Analyzer analyzer; // how to analyze text
@@ -116,7 +116,7 @@
* files used. Setting this to false may improve indexing performance, but
* may also cause file handle problems.
*/
- private boolean useCompoundFile = true;
+ private boolean useCompoundFile = DEFAULT_USE_COMPOUND_FILE;
private boolean closeDir;



--

Use Rojo (RSS/Atom aggregator). Visit http://rojo.com. Ask me for an invite! Also see irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html

If you're interested in RSS, Weblogs, Social Networking, etc... then you should work for Rojo! If you recommend someone and we hire them you'll get a free iPod!
Kevin A. Burton, Location - San Francisco, CA
AIM/YIM - sfburtonator, Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to