2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 namespace Mono.Lucene.Net.Index
23 public sealed class FieldInfo : System.ICloneable
25 internal System.String name;
26 internal bool isIndexed;
29 // true if term vector for this field should be stored
30 internal bool storeTermVector;
31 internal bool storeOffsetWithTermVector;
32 internal bool storePositionWithTermVector;
34 internal bool omitNorms; // omit norms associated with indexed fields
35 internal bool omitTermFreqAndPositions;
37 internal bool storePayloads; // whether this field stores payloads together with term positions
39 internal FieldInfo(System.String na, bool tk, int nu, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions)
46 this.storeTermVector = storeTermVector;
47 this.storeOffsetWithTermVector = storeOffsetWithTermVector;
48 this.storePositionWithTermVector = storePositionWithTermVector;
49 this.storePayloads = storePayloads;
50 this.omitNorms = omitNorms;
51 this.omitTermFreqAndPositions = omitTermFreqAndPositions;
55 // for non-indexed fields, leave defaults
56 this.storeTermVector = false;
57 this.storeOffsetWithTermVector = false;
58 this.storePositionWithTermVector = false;
59 this.storePayloads = false;
60 this.omitNorms = true;
61 this.omitTermFreqAndPositions = false;
65 public System.Object Clone()
67 return new FieldInfo(name, isIndexed, number, storeTermVector, storePositionWithTermVector, storeOffsetWithTermVector, omitNorms, storePayloads, omitTermFreqAndPositions);
70 internal void Update(bool isIndexed, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms, bool storePayloads, bool omitTermFreqAndPositions)
72 if (this.isIndexed != isIndexed)
74 this.isIndexed = true; // once indexed, always index
78 // if updated field data is not for indexing, leave the updates out
79 if (this.storeTermVector != storeTermVector)
81 this.storeTermVector = true; // once vector, always vector
83 if (this.storePositionWithTermVector != storePositionWithTermVector)
85 this.storePositionWithTermVector = true; // once vector, always vector
87 if (this.storeOffsetWithTermVector != storeOffsetWithTermVector)
89 this.storeOffsetWithTermVector = true; // once vector, always vector
91 if (this.storePayloads != storePayloads)
93 this.storePayloads = true;
95 if (this.omitNorms != omitNorms)
97 this.omitNorms = false; // once norms are stored, always store
99 if (this.omitTermFreqAndPositions != omitTermFreqAndPositions)
101 this.omitTermFreqAndPositions = true; // if one require omitTermFreqAndPositions at least once, it remains off for life
106 public bool storePayloads_ForNUnit
108 get { return storePayloads; }
111 public System.String name_ForNUnit
116 public bool isIndexed_ForNUnit
118 get { return isIndexed; }
121 public bool omitNorms_ForNUnit
123 get { return omitNorms; }
126 public bool omitTermFreqAndPositions_ForNUnit
128 get { return omitTermFreqAndPositions; }
131 public bool storeTermVector_ForNUnit
133 get { return storeTermVector; }