1 package org.apache.lucene.index;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import java.io.PrintStream;
22 import org.apache.lucene.store.Directory;
23 import org.apache.lucene.util.BitVector;
26 * @lucene.experimental
28 public class SegmentWriteState {
29 public final PrintStream infoStream;
30 public final Directory directory;
31 public final String segmentName;
32 public final FieldInfos fieldInfos;
33 public final int numDocs;
34 public boolean hasVectors;
36 // Deletes to apply while we are flushing the segment. A
37 // Term is enrolled in here if it was deleted at one
38 // point, and it's mapped to the docIDUpto, meaning any
39 // docID < docIDUpto containing this term should be
41 public final BufferedDeletes segDeletes;
44 public BitVector deletedDocs;
46 /** Expert: The fraction of terms in the "dictionary" which should be stored
47 * in RAM. Smaller values use more memory, but make searching slightly
48 * faster, while larger values use less memory and make searching slightly
49 * slower. Searching is typically not dominated by dictionary lookup, so
50 * tweaking this is rarely useful.*/
51 public final int termIndexInterval;
53 /** Expert: The fraction of TermDocs entries stored in skip tables,
54 * used to accelerate {@link TermDocs#skipTo(int)}. Larger values result in
55 * smaller indexes, greater acceleration, but fewer accelerable cases, while
56 * smaller values result in bigger indexes, less acceleration and more
57 * accelerable cases. More detailed experiments would be useful here. */
58 public final int skipInterval = 16;
60 /** Expert: The maximum number of skip levels. Smaller values result in
61 * slightly smaller indexes, but slower skipping in big posting lists.
63 public final int maxSkipLevels = 10;
65 public SegmentWriteState(PrintStream infoStream, Directory directory, String segmentName, FieldInfos fieldInfos,
66 int numDocs, int termIndexInterval, BufferedDeletes segDeletes) {
67 this.infoStream = infoStream;
68 this.segDeletes = segDeletes;
69 this.directory = directory;
70 this.segmentName = segmentName;
71 this.fieldInfos = fieldInfos;
72 this.numDocs = numDocs;
73 this.termIndexInterval = termIndexInterval;