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.
17 using InputStream
= Lucene
.Net
.Store
.InputStream
;
18 namespace Lucene
.Net
.Index
21 sealed class SegmentTermPositions
: SegmentTermDocs
, TermPositions
23 private InputStream proxStream
;
24 private int proxCount
;
27 internal SegmentTermPositions(SegmentReader p
):base(p
)
29 this.proxStream
= (InputStream
) parent
.proxStream
.Clone();
32 internal override void Seek(TermInfo ti
)
36 proxStream
.Seek(ti
.proxPointer
);
40 public override void Close()
46 public int NextPosition()
49 return position
+= proxStream
.ReadVInt();
52 protected internal override void SkippingDoc()
54 for (int f
= freq
; f
> 0; f
--)
56 proxStream
.ReadVInt();
59 public override bool Next()
61 for (int f
= proxCount
; f
> 0; f
--)
62 // skip unread positions
63 proxStream
.ReadVInt();
68 proxCount
= freq
; // note frequency
69 position
= 0; // reset position
75 public override int Read(int[] docs
, int[] freqs
)
77 throw new System
.NotSupportedException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead.");
81 /// <summary>Called by base.SkipTo(). </summary>
82 protected internal override void SkipProx(long proxPointer
)
84 proxStream
.Seek(proxPointer
);