Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
TermDocs.cs
Go to the documentation of this file.
1 /*
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
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17 
18 using System;
19 
20 namespace Lucene.Net.Index
21 {
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  public interface TermDocs : IDisposable
30  {
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);
35 
36  /// <summary>Sets this to the data for the current term in a <see cref="TermEnum" />.
37  /// This may be optimized in some implementations.
38  /// </summary>
39  void Seek(TermEnum termEnum);
40 
41  /// <summary>Returns the current document number. <p/> This is invalid until <see cref="Next()" />
42  /// is called for the first time.
43  /// </summary>
44  int Doc { get; }
45 
46  /// <summary>Returns the frequency of the term within the current document. <p/> This
47  /// is invalid until <see cref="Next()" /> is called for the first time.
48  /// </summary>
49  int Freq { get; }
50 
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();
55 
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);
65 
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: <code>
69  /// boolean skipTo(int target) {
70  /// do {
71  /// if (!next())
72  /// return false;
73  /// } while (target > doc());
74  /// return true;
75  /// }
76  /// </code>
77  /// Some implementations are considerably more efficient than that.
78  /// </summary>
79  bool SkipTo(int target);
80 
81  // TODO: Determine which release this will be removed from
82  /// <summary>Frees associated resources. </summary>
83  [Obsolete("Use Dispose() instead")]
84  void Close();
85  }
86 }