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 Lucene
.Net
.Index
;
20 namespace Lucene
.Net
.Search
23 sealed class PhrasePositions
25 internal int doc
; // current doc
26 internal int position
; // position in doc
27 internal int count
; // remaining pos in this doc
28 internal int offset
; // position in phrase
29 internal TermPositions tp
; // stream of positions
30 internal PhrasePositions next
; // used to make lists
32 internal PhrasePositions(TermPositions t
, int o
)
40 // increments to next doc
43 tp
.Close(); // close stream
44 doc
= System
.Int32
.MaxValue
; // sentinel value
52 internal bool SkipTo(int target
)
54 if (!tp
.SkipTo(target
))
56 tp
.Close(); // close stream
57 doc
= System
.Int32
.MaxValue
; // sentinel value
66 internal void FirstPosition()
68 count
= tp
.Freq(); // read first pos
72 internal bool NextPosition()
76 // read subsequent pos's
77 position
= tp
.NextPosition() - offset
;