FileDocCategorySizeDatePackage
SegmentTermPositions.javaAPI DocApache Lucene 2.1.03824Wed Feb 14 10:46:40 GMT 2007org.apache.lucene.index

SegmentTermPositions

public final class SegmentTermPositions extends SegmentTermDocs implements TermPositions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Fields Summary
private IndexInput
proxStream
private int
proxCount
private int
position
private long
lazySkipPointer
private int
lazySkipDocCount
Constructors Summary
SegmentTermPositions(SegmentReader p)

  
    
    super(p);
    this.proxStream = (IndexInput)parent.proxStream.clone();
  
Methods Summary
public final voidclose()

    super.close();
    proxStream.close();
  
private voidlazySkip()

    if (lazySkipPointer != 0) {
      proxStream.seek(lazySkipPointer);
      lazySkipPointer = 0;
    }
     
    if (lazySkipDocCount != 0) {
      skipPositions(lazySkipDocCount);
      lazySkipDocCount = 0;
    }
  
public final booleannext()

    // we remember to skip a document lazily
    lazySkipDocCount += proxCount;
    
    if (super.next()) {               // run super
      proxCount = freq;               // note frequency
      position = 0;               // reset position
      return true;
    }
    return false;
  
public final intnextPosition()

    // perform lazy skips if neccessary
    lazySkip();
    proxCount--;
    return position += proxStream.readVInt();
  
public final intread(int[] docs, int[] freqs)

    throw new UnsupportedOperationException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead.");
  
final voidseek(org.apache.lucene.index.TermInfo ti)

    super.seek(ti);
    if (ti != null)
      lazySkipPointer = ti.proxPointer;
    
    lazySkipDocCount = 0;
    proxCount = 0;
  
private voidskipPositions(int n)

    for (int f = n; f > 0; f--)         // skip unread positions
      proxStream.readVInt();
  
protected voidskipProx(long proxPointer)
Called by super.skipTo().

    // we save the pointer, we might have to skip there lazily
    lazySkipPointer = proxPointer;
    lazySkipDocCount = 0;
    proxCount = 0;
  
protected final voidskippingDoc()

    // we remember to skip the remaining positions of the current
    // document lazily
    lazySkipDocCount += freq;