001: /*
002: * Copyright 2004-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.compass.core.lucene;
018:
019: /**
020: * A set of settings constants that applies on the Compass session level.
021: *
022: * @author kimchy
023: */
024: public abstract class RuntimeLuceneEnvironment {
025:
026: /**
027: * Specific environment settings for the <code>batch_insert</code> settings.
028: */
029: public static abstract class SearchEngineIndex {
030:
031: /**
032: * <p>Determines the largest segment (measured by
033: * document count) that may be merged with other segments.
034: * Small values (e.g., less than 10,000) are best for
035: * interactive indexing, as this limits the length of
036: * pauses while indexing to a few seconds. Larger values
037: * are best for batched indexing and speedier
038: * searches.</p>
039: *
040: * <p>The default value is {@link Integer#MAX_VALUE}.</p>
041: */
042: public static final String MAX_MERGE_DOCS = "compass.engine.maxMergeDocs";
043:
044: /**
045: * Determines how often segment indices are merged by addDocument(). With
046: * smaller values, less RAM is used while indexing, and searches on
047: * unoptimized indices are faster, but indexing speed is slower. With larger
048: * values, more RAM is used during indexing, and while searches on unoptimized
049: * indices are slower, indexing is faster. Thus larger values (> 10) are best
050: * for batch index creation, and smaller values (< 10) for indices that are
051: * interactively maintained.
052: *
053: * <p>Defaults to <code>10</code>.
054: */
055: public static final String MERGE_FACTOR = "compass.engine.mergeFactor";
056:
057: /**
058: * Determines the minimal number of documents required
059: * before the buffered in-memory documents are flushed as
060: * a new Segment. Large values generally gives faster
061: * indexing.
062: *
063: * <p>When this is set, the writer will flush every
064: * maxBufferedDocs added documents. Pass in {@link
065: * org.apache.lucene.index.IndexWriter#DISABLE_AUTO_FLUSH} to prevent triggering a flush due
066: * to number of buffered documents. Note that if flushing
067: * by RAM usage is also enabled, then the flush will be
068: * triggered by whichever comes first.
069: *
070: * <p>Disabled by default (writer flushes by RAM usage).
071: */
072: public static final String MAX_BUFFERED_DOCS = "compass.engine.maxBufferedDocs";
073:
074: /**
075: * <p>Determines the minimal number of delete terms required before the buffered
076: * in-memory delete terms are applied and flushed. If there are documents
077: * buffered in memory at the time, they are merged and a new segment is
078: * created.</p>
079: *
080: * <p>Disabled by default (writer flushes by RAM usage).</p>
081: */
082: public static final String MAX_BUFFERED_DELETED_TERMS = "compass.engine.maxBufferedDeletedTerms";
083:
084: /**
085: * Determines the amount of RAM that may be used for
086: * buffering added documents before they are flushed as a
087: * new Segment. Generally for faster indexing performance
088: * it's best to flush by RAM usage instead of document
089: * count and use as large a RAM buffer as you can.
090: *
091: * <p>When this is set, the writer will flush whenever
092: * buffered documents use this much RAM. Pass in {@link
093: * org.apache.lucene.index.IndexWriter#DISABLE_AUTO_FLUSH} to prevent triggering a flush due
094: * to RAM usage. Note that if flushing by document count
095: * is also enabled, then the flush will be triggered by
096: * whichever comes first.</p>
097: *
098: * <p> The default value is {@link org.apache.lucene.index.IndexWriter#DEFAULT_RAM_BUFFER_SIZE_MB}.</p>
099: */
100: public static final String RAM_BUFFER_SIZE = "compass.engine.ramBufferSize";
101: }
102:
103: public static abstract class Transaction {
104:
105: /**
106: * Transaction log settings
107: */
108: public static final class ReadCommittedTransLog {
109:
110: /**
111: * The connection type for the read committed transactional log. Can be either <code>ram://</code>
112: * or <code>file://</code>.
113: */
114: public static final String CONNECTION = "compass.transaction.readcommitted.translog.connection";
115:
116: /**
117: * Should the transactional index be optimized before it is added to the actual index. Defaults to
118: * <code>true</code>.
119: */
120: public static final String OPTIMIZE_TRANS_LOG = "compass.transaction.readcommitted.translog.optimize";
121: }
122: }
123:
124: /**
125: * Controls Lucene {@link org.apache.lucene.index.MergePolicy} configuration.
126: */
127: public static abstract class MergePolicy {
128:
129: /**
130: * The prefix setting for merge policy.
131: */
132: public static final String PREFIX = "compass.engine.merge.policy";
133:
134: /**
135: * The type of the {@link org.compass.core.lucene.engine.merge.policy.MergePolicyProvider} that
136: * will be created. Can be one of the constant names of specific types (inner classes) or the
137: * FQN of a merge policy provider.
138: */
139: public static final String TYPE = PREFIX + ".type";
140:
141: /**
142: * Allows to cofnigure {@link org.apache.lucene.index.LogByteSizeMergePolicy}.
143: */
144: public abstract class LogByteSize {
145:
146: /**
147: * The name of the merge policy to be used with the merge policy type.
148: */
149: public static final String NAME = "logbytesize";
150:
151: /**
152: * @see {@link org.apache.lucene.index.LogByteSizeMergePolicy#setMaxMergeMB(double)}.
153: */
154: public static final String MAX_MERGE_MB = PREFIX
155: + ".maxMergeMB";
156:
157: /**
158: * @see {@link org.apache.lucene.index.LogByteSizeMergePolicy#setMinMergeMB(double)}.
159: */
160: public static final String MIN_MERGE_MB = PREFIX
161: + ".minMergeMB";
162: }
163:
164: /**
165: * Allows to configure {@link org.apache.lucene.index.LogDocMergePolicy}.
166: */
167: public abstract class LogDoc {
168:
169: /**
170: * The name of the merge policy to be used with the merge policy type.
171: */
172: public static final String NAME = "logdoc";
173:
174: /**
175: * @see {@link org.apache.lucene.index.LogDocMergePolicy#setMaxMergeDocs(int)}.
176: */
177: public static final String MAX_MERGE_DOCS = PREFIX
178: + ".maxMergeDocs";
179:
180: /**
181: * @see {@link org.apache.lucene.index.LogDocMergePolicy#setMinMergeDocs(int)}.
182: */
183: public static final String MIN_MERGE_DOCS = PREFIX
184: + ".minMergeDocs";
185: }
186: }
187:
188: /**
189: * Controls Lucene {@link org.compass.core.lucene.LuceneEnvironment.MergeScheduler} configuration.
190: */
191: public static abstract class MergeScheduler {
192:
193: /**
194: * The prefix setting for merge scheduler.
195: */
196: public static final String PREFIX = "compass.engine.merge.scheduler";
197:
198: /**
199: * The type of the {@link org.compass.core.lucene.engine.merge.scheduler.MergeSchedulerProvider} that
200: * will be created. Can be one of the constant names of specific types (inner classes) or the
201: * FQN of a merge scheduler provider.
202: */
203: public static final String TYPE = PREFIX + ".type";
204:
205: /**
206: * Allows to cofnigure {@link org.apache.lucene.index.SerialMergeScheduler}.
207: */
208: public abstract class Serial {
209:
210: /**
211: * The name of the serial merge scheduler to be used as the merge scheduler type.
212: */
213: public static final String NAME = "serial";
214: }
215:
216: /**
217: * Allows to configure {@link org.apache.lucene.index.ConcurrentMergeScheduler}.
218: */
219: public abstract class Concurrent {
220:
221: /**
222: * The name of the concurrent merge scheduler to be used as the merge scheduler type.
223: */
224: public static final String NAME = "concurrent";
225:
226: /**
227: * The maximum thread count that can be created for merges.
228: */
229: public static final String MAX_THREAD_COUNT = "maxThreadCount";
230:
231: /**
232: * The thread priority of merge threads.
233: */
234: public static final String THREAD_PRIORITY = "threadPriority";
235: }
236:
237: /**
238: * Allows to configure Compass {@link org.apache.lucene.index.ExecutorMergeScheduler}.
239: */
240: public abstract class Executor {
241:
242: /**
243: * The name of the executor merge scheduler to be used as the merge scheduler type.
244: */
245: public static final String NAME = "executor";
246:
247: /**
248: * The maximum concurrent merges that are allowed to be executed.
249: */
250: public static final String MAX_CONCURRENT_MERGE = "maxConcurrentMerge";
251:
252: }
253: }
254: }
|