cvsimport
[beagle.git] / beagled / Lucene.Net / Index / TermDocs.cs
blob64d485e366b9ee65c9450c6d2e59522e54202389
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.
17 using System;
19 namespace Lucene.Net.Index
22 /// <summary>TermDocs provides an interface for enumerating &lt;document, frequency&gt;
23 /// pairs for a term. <p> The document portion names each document containing
24 /// the term. Documents are indicated by number. The frequency portion gives
25 /// the number of times the term occurred in each document. <p> The pairs are
26 /// ordered by document number.
27 /// </summary>
28 /// <seealso cref="IndexReader.TermDocs()">
29 /// </seealso>
31 public interface TermDocs
33 /// <summary>Sets this to the data for a term.
34 /// The enumeration is reset to the start of the data for this term.
35 /// </summary>
36 void Seek(Term term);
38 /// <summary>Sets this to the data for the current term in a {@link TermEnum}.
39 /// This may be optimized in some implementations.
40 /// </summary>
41 void Seek(TermEnum termEnum);
43 /// <summary>Returns the current document number. <p> This is invalid until {@link
44 /// #Next()} is called for the first time.
45 /// </summary>
46 int Doc();
48 /// <summary>Returns the frequency of the term within the current document. <p> This
49 /// is invalid until {@link #Next()} is called for the first time.
50 /// </summary>
51 int Freq();
53 /// <summary>Moves to the next pair in the enumeration. <p> Returns true iff there is
54 /// such a next pair in the enumeration.
55 /// </summary>
56 bool Next();
58 /// <summary>Attempts to read multiple entries from the enumeration, up to length of
59 /// <i>docs</i>. Document numbers are stored in <i>docs</i>, and term
60 /// frequencies are stored in <i>freqs</i>. The <i>freqs</i> array must be as
61 /// long as the <i>docs</i> array.
62 ///
63 /// <p>Returns the number of entries read. Zero is only returned when the
64 /// stream has been exhausted.
65 /// </summary>
66 int Read(int[] docs, int[] freqs);
68 /// <summary>Skips entries to the first beyond the current whose document number is
69 /// greater than or equal to <i>target</i>. <p>Returns true iff there is such
70 /// an entry. <p>Behaves as if written: <pre>
71 /// boolean skipTo(int target) {
72 /// do {
73 /// if (!next())
74 /// return false;
75 /// } while (target > doc());
76 /// return true;
77 /// }
78 /// </pre>
79 /// Some implementations are considerably more efficient than that.
80 /// </summary>
81 bool SkipTo(int target);
83 /// <summary>Frees associated resources. </summary>
84 void Close();