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.
| Method from org.apache.lucene.index.SegmentTermPositions Detail: |
public final void close() throws IOException {
super.close();
if (proxStream != null) proxStream.close();
}
|
public byte[] getPayload(byte[] data,
int offset) throws IOException {
if (!needToLoadPayload) {
throw new IOException("Payload cannot be loaded more than once for the same term position.");
}
// read payloads lazily
byte[] retArray;
int retOffset;
if (data == null || data.length - offset < payloadLength) {
// the array is too small to store the payload data,
// so we allocate a new one
retArray = new byte[payloadLength];
retOffset = 0;
} else {
retArray = data;
retOffset = offset;
}
proxStream.readBytes(retArray, retOffset, payloadLength);
needToLoadPayload = false;
return retArray;
}
|
public int getPayloadLength() {
return payloadLength;
}
|
public boolean isPayloadAvailable() {
return needToLoadPayload && payloadLength > 0;
}
|
public final boolean next() throws IOException {
// we remember to skip the remaining positions of the current
// document lazily
lazySkipProxCount += proxCount;
if (super.next()) { // run super
proxCount = freq; // note frequency
position = 0; // reset position
return true;
}
return false;
}
|
public final int nextPosition() throws IOException {
// perform lazy skips if neccessary
lazySkip();
proxCount--;
return position += readDeltaPosition();
}
|
public final int read(int[] docs,
int[] freqs) {
throw new UnsupportedOperationException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead.");
}
|
final void seek(TermInfo ti,
Term term) throws IOException {
super.seek(ti, term);
if (ti != null)
lazySkipPointer = ti.proxPointer;
lazySkipProxCount = 0;
proxCount = 0;
payloadLength = 0;
needToLoadPayload = false;
}
|
protected void skipProx(long proxPointer,
int payloadLength) throws IOException {
// we save the pointer, we might have to skip there lazily
lazySkipPointer = proxPointer;
lazySkipProxCount = 0;
proxCount = 0;
this.payloadLength = payloadLength;
needToLoadPayload = false;
}
Called by super.skipTo(). |
protected final void skippingDoc() throws IOException {
// we remember to skip a document lazily
lazySkipProxCount += freq;
}
|