Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / Index / FilterIndexReader.cs
blob39bc42e670ebbeab5c131056328a7f6b3aa4b3e6
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 namespace Lucene.Net.Index
21 /// <summary>A <code>FilterIndexReader</code> contains another IndexReader, which it
22 /// uses as its basic source of data, possibly transforming the data along the
23 /// way or providing additional functionality. The class
24 /// <code>FilterIndexReader</code> itself simply implements all abstract methods
25 /// of <code>IndexReader</code> with versions that pass all requests to the
26 /// contained index reader. Subclasses of <code>FilterIndexReader</code> may
27 /// further override some of these methods and may also provide additional
28 /// methods and fields.
29 /// </summary>
30 public class FilterIndexReader : IndexReader
33 /// <summary>Base class for filtering {@link TermDocs} implementations. </summary>
34 public class FilterTermDocs : TermDocs
36 protected internal TermDocs in_Renamed;
38 public FilterTermDocs(TermDocs in_Renamed)
40 this.in_Renamed = in_Renamed;
43 public virtual void Seek(Term term)
45 in_Renamed.Seek(term);
47 public virtual void Seek(TermEnum termEnum)
49 in_Renamed.Seek(termEnum);
51 public virtual int Doc()
53 return in_Renamed.Doc();
55 public virtual int Freq()
57 return in_Renamed.Freq();
59 public virtual bool Next()
61 return in_Renamed.Next();
63 public virtual int Read(int[] docs, int[] freqs)
65 return in_Renamed.Read(docs, freqs);
67 public virtual bool SkipTo(int i)
69 return in_Renamed.SkipTo(i);
71 public virtual void Close()
73 in_Renamed.Close();
77 /// <summary>Base class for filtering {@link TermPositions} implementations. </summary>
78 public class FilterTermPositions:FilterTermDocs, TermPositions
81 public FilterTermPositions(TermPositions in_Renamed):base(in_Renamed)
85 public virtual int NextPosition()
87 return ((TermPositions) this.in_Renamed).NextPosition();
91 /// <summary>Base class for filtering {@link TermEnum} implementations. </summary>
92 public class FilterTermEnum:TermEnum
94 protected internal TermEnum in_Renamed;
96 public FilterTermEnum(TermEnum in_Renamed)
98 this.in_Renamed = in_Renamed;
101 public override bool Next()
103 return in_Renamed.Next();
105 public override Term Term()
107 return in_Renamed.Term();
109 public override int DocFreq()
111 return in_Renamed.DocFreq();
113 public override void Close()
115 in_Renamed.Close();
119 protected internal IndexReader in_Renamed;
121 /// <summary> <p>Construct a FilterIndexReader based on the specified base reader.
122 /// Directory locking for delete, undeleteAll, and setNorm operations is
123 /// left to the base reader.</p>
124 /// <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
125 /// </summary>
126 /// <param name="in">specified base reader.
127 /// </param>
128 public FilterIndexReader(IndexReader in_Renamed):base(in_Renamed.Directory())
130 this.in_Renamed = in_Renamed;
133 public override TermFreqVector[] GetTermFreqVectors(int docNumber)
135 return in_Renamed.GetTermFreqVectors(docNumber);
138 public override TermFreqVector GetTermFreqVector(int docNumber, System.String field)
140 return in_Renamed.GetTermFreqVector(docNumber, field);
143 public override int NumDocs()
145 return in_Renamed.NumDocs();
147 public override int MaxDoc()
149 return in_Renamed.MaxDoc();
152 public override Document Document(int n)
154 return in_Renamed.Document(n);
157 public override bool IsDeleted(int n)
159 return in_Renamed.IsDeleted(n);
161 public override bool HasDeletions()
163 return in_Renamed.HasDeletions();
165 protected internal override void DoUndeleteAll()
167 in_Renamed.UndeleteAll();
170 public override byte[] Norms(System.String f)
172 return in_Renamed.Norms(f);
174 public override void Norms(System.String f, byte[] bytes, int offset)
176 in_Renamed.Norms(f, bytes, offset);
178 protected internal override void DoSetNorm(int d, System.String f, byte b)
180 in_Renamed.SetNorm(d, f, b);
183 public override TermEnum Terms()
185 return in_Renamed.Terms();
187 public override TermEnum Terms(Term t)
189 return in_Renamed.Terms(t);
192 public override int DocFreq(Term t)
194 return in_Renamed.DocFreq(t);
197 public override TermDocs TermDocs()
199 return in_Renamed.TermDocs();
202 public override TermPositions TermPositions()
204 return in_Renamed.TermPositions();
207 protected internal override void DoDelete(int n)
209 in_Renamed.Delete(n);
211 protected internal override void DoCommit()
213 in_Renamed.Commit();
215 protected internal override void DoClose()
217 in_Renamed.Close();
220 public override System.Collections.ICollection GetFieldNames()
222 return in_Renamed.GetFieldNames();
225 public override System.Collections.ICollection GetFieldNames(bool indexed)
227 return in_Renamed.GetFieldNames(indexed);
230 /// <summary> </summary>
231 /// <param name="storedTermVector">if true, returns only Indexed fields that have term vector info,
232 /// else only indexed fields without term vector info
233 /// </param>
234 /// <returns> Collection of Strings indicating the names of the fields
235 /// </returns>
236 public override System.Collections.ICollection GetIndexedFieldNames(bool storedTermVector)
238 return in_Renamed.GetIndexedFieldNames(storedTermVector);