2 * Copyright 2004 The Apache Software Foundation
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using IndexInput
= Lucene
.Net
.Store
.IndexInput
;
20 namespace Lucene
.Net
.Index
23 sealed class SegmentTermPositions
: SegmentTermDocs
, TermPositions
25 private IndexInput proxStream
;
26 private int proxCount
;
29 internal SegmentTermPositions(SegmentReader p
) : base(p
)
31 this.proxStream
= (IndexInput
) parent
.proxStream
.Clone();
34 internal override void Seek(TermInfo ti
)
38 proxStream
.Seek(ti
.proxPointer
);
42 public override void Close()
48 public int NextPosition()
51 return position
+= proxStream
.ReadVInt();
54 protected internal override void SkippingDoc()
56 for (int f
= freq
; f
> 0; f
--)
58 proxStream
.ReadVInt();
61 public override bool Next()
63 for (int f
= proxCount
; f
> 0; f
--)
64 // skip unread positions
65 proxStream
.ReadVInt();
70 proxCount
= freq
; // note frequency
71 position
= 0; // reset position
77 public override int Read(int[] docs
, int[] freqs
)
79 throw new System
.NotSupportedException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead.");
83 /// <summary>Called by super.skipTo(). </summary>
84 protected internal override void SkipProx(long proxPointer
)
86 proxStream
.Seek(proxPointer
);