Add --enable-deletion option to buildindex. If used, buildindex will remove deleted...
[beagle.git] / beagled / Lucene.Net / Index / FilterIndexReader.cs
blobd65083d260bb3eb540baf6f59e5273ea20ce3c8d
1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 using System;
17 using Document = Lucene.Net.Documents.Document;
18 using Field = Lucene.Net.Documents.Field;
19 namespace Lucene.Net.Index
22 /// <summary>A <code>FilterIndexReader</code> contains another IndexReader, which it
23 /// uses as its basic source of data, possibly transforming the data along the
24 /// way or providing additional functionality. The class
25 /// <code>FilterIndexReader</code> itself simply implements all abstract methods
26 /// of <code>IndexReader</code> with versions that pass all requests to the
27 /// contained index reader. Subclasses of <code>FilterIndexReader</code> may
28 /// further override some of these methods and may also provide additional
29 /// methods and fields.
30 /// </summary>
31 public class FilterIndexReader : IndexReader
34 /// <summary>Base class for filtering {@link TermDocs} implementations. </summary>
35 public class FilterTermDocs : TermDocs
37 protected internal TermDocs in_Renamed;
39 public FilterTermDocs(TermDocs in_Renamed)
41 this.in_Renamed = in_Renamed;
44 public virtual void Seek(Term term)
46 in_Renamed.Seek(term);
48 public virtual void Seek(TermEnum termEnum)
50 in_Renamed.Seek(termEnum);
52 public virtual int Doc()
54 return in_Renamed.Doc();
56 public virtual int Freq()
58 return in_Renamed.Freq();
60 public virtual bool Next()
62 return in_Renamed.Next();
64 public virtual int Read(int[] docs, int[] freqs)
66 return in_Renamed.Read(docs, freqs);
68 public virtual bool SkipTo(int i)
70 return in_Renamed.SkipTo(i);
72 public virtual void Close()
74 in_Renamed.Close();
78 /// <summary>Base class for filtering {@link TermPositions} implementations. </summary>
79 public class FilterTermPositions:FilterTermDocs, TermPositions
82 public FilterTermPositions(TermPositions in_Renamed) : base(in_Renamed)
86 public virtual int NextPosition()
88 return ((TermPositions) this.in_Renamed).NextPosition();
92 /// <summary>Base class for filtering {@link TermEnum} implementations. </summary>
93 public class FilterTermEnum : TermEnum
95 protected internal TermEnum in_Renamed;
97 public FilterTermEnum(TermEnum in_Renamed)
99 this.in_Renamed = in_Renamed;
102 public override bool Next()
104 return in_Renamed.Next();
106 public override Term Term()
108 return in_Renamed.Term();
110 public override int DocFreq()
112 return in_Renamed.DocFreq();
114 public override void Close()
116 in_Renamed.Close();
120 protected internal IndexReader in_Renamed;
122 /// <summary> <p>Construct a FilterIndexReader based on the specified base reader.
123 /// Directory locking for delete, undeleteAll, and setNorm operations is
124 /// left to the base reader.</p>
125 /// <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
126 /// </summary>
127 /// <param name="in">specified base reader.
128 /// </param>
129 public FilterIndexReader(IndexReader in_Renamed):base(in_Renamed.Directory())
131 this.in_Renamed = in_Renamed;
134 public override TermFreqVector[] GetTermFreqVectors(int docNumber)
136 return in_Renamed.GetTermFreqVectors(docNumber);
139 public override TermFreqVector GetTermFreqVector(int docNumber, System.String field)
141 return in_Renamed.GetTermFreqVector(docNumber, field);
144 public override int NumDocs()
146 return in_Renamed.NumDocs();
148 public override int MaxDoc()
150 return in_Renamed.MaxDoc();
153 public override Document Document(int n)
155 return in_Renamed.Document(n);
158 public override bool IsDeleted(int n)
160 return in_Renamed.IsDeleted(n);
162 public override bool HasDeletions()
164 return in_Renamed.HasDeletions();
166 protected internal override void DoUndeleteAll()
168 in_Renamed.UndeleteAll();
171 public override byte[] Norms(System.String f)
173 return in_Renamed.Norms(f);
175 public override void Norms(System.String f, byte[] bytes, int offset)
177 in_Renamed.Norms(f, bytes, offset);
179 protected internal override void DoSetNorm(int d, System.String f, byte b)
181 in_Renamed.SetNorm(d, f, b);
184 public override TermEnum Terms()
186 return in_Renamed.Terms();
188 public override TermEnum Terms(Term t)
190 return in_Renamed.Terms(t);
193 public override int DocFreq(Term t)
195 return in_Renamed.DocFreq(t);
198 public override TermDocs TermDocs()
200 return in_Renamed.TermDocs();
203 public override TermPositions TermPositions()
205 return in_Renamed.TermPositions();
208 protected internal override void DoDelete(int n)
210 in_Renamed.Delete(n);
212 protected internal override void DoCommit()
214 in_Renamed.Commit();
216 protected internal override void DoClose()
218 in_Renamed.Close();
221 public override System.Collections.ICollection GetFieldNames()
223 return in_Renamed.GetFieldNames();
226 public override System.Collections.ICollection GetFieldNames(bool indexed)
228 return in_Renamed.GetFieldNames(indexed);
231 public override System.Collections.ICollection GetIndexedFieldNames(Field.TermVector tvSpec)
233 return in_Renamed.GetIndexedFieldNames(tvSpec);
236 public override System.Collections.ICollection GetFieldNames(IndexReader.FieldOption fieldNames)
238 return in_Renamed.GetFieldNames(fieldNames);