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 Lucene
.Net
.Index
;
18 namespace Lucene
.Net
.Search
21 sealed class PhrasePositions
23 internal int doc
; // current doc
24 internal int position
; // position in doc
25 internal int count
; // remaining pos in this doc
26 internal int offset
; // position in phrase
27 internal TermPositions tp
; // stream of positions
28 internal PhrasePositions next
; // used to make lists
30 internal PhrasePositions(TermPositions t
, int o
)
38 // increments to next doc
41 tp
.Close(); // close stream
42 doc
= System
.Int32
.MaxValue
; // sentinel value
50 internal bool SkipTo(int target
)
52 if (!tp
.SkipTo(target
))
54 tp
.Close(); // close stream
55 doc
= System
.Int32
.MaxValue
; // sentinel value
64 internal void FirstPosition()
66 count
= tp
.Freq(); // read first pos
70 internal bool NextPosition()
74 // read subsequent pos's
75 position
= tp
.NextPosition() - offset
;