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