You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by bu...@apache.org on 2007/03/11 08:06:42 UTC
svn commit: r516863 - in /lucene/java/trunk: CHANGES.txt
src/java/org/apache/lucene/index/SegmentTermPositions.java
Author: buschmi
Date: Sat Mar 10 23:06:40 2007
New Revision: 516863
URL: http://svn.apache.org/viewvc?view=rev&rev=516863
Log:
LUCENE-761: The proxStream is now cloned lazily in SegmentTermPositions when nextPosition() is called for the first time.
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermPositions.java
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=516863&r1=516862&r2=516863
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Mar 10 23:06:40 2007
@@ -66,6 +66,10 @@
Optimizations
+ 1. LUCENE-761: The proxStream is now cloned lazily in SegmentTermPositions
+ when nextPosition() is called for the first time. This allows using instances
+ of SegmentTermPositions instead of SegmentTermDocs without additional costs.
+ (Michael Busch)
Documentation:
1. LUCENE 791 && INFRA-1173: Infrastructure moved the Wiki to http://wiki.apache.org/lucene-java/ Updated the links in the docs and wherever else I found references. (Grant Ingersoll, Joe Schaefer)
Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermPositions.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermPositions.java?view=diff&rev=516863&r1=516862&r2=516863
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermPositions.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentTermPositions.java Sat Mar 10 23:06:40 2007
@@ -34,7 +34,7 @@
SegmentTermPositions(SegmentReader p) {
super(p);
- this.proxStream = (IndexInput)parent.proxStream.clone();
+ this.proxStream = null; // the proxStream will be cloned lazily when nextPosition() is called for the first time
}
final void seek(TermInfo ti) throws IOException {
@@ -48,7 +48,7 @@
public final void close() throws IOException {
super.close();
- proxStream.close();
+ if (proxStream != null) proxStream.close();
}
public final int nextPosition() throws IOException {
@@ -105,6 +105,11 @@
// So we move the prox pointer lazily to the document
// as soon as positions are requested.
private void lazySkip() throws IOException {
+ if (proxStream == null) {
+ // clone lazily
+ proxStream = (IndexInput)parent.proxStream.clone();
+ }
+
if (lazySkipPointer != 0) {
proxStream.seek(lazySkipPointer);
lazySkipPointer = 0;