From f205a8bc19ccc8ff93eb1923ad4c01d766b040b7 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 9 Jun 2014 11:11:22 +0000 Subject: [PATCH] improve javadocs git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1601342 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/IndexReader.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java index 25683153625..6d1c5bcb145 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java @@ -32,9 +32,19 @@ import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicInteger; // javadocs -/** IndexReader is an abstract class, providing an interface for accessing an - index. Search of an index is done entirely through this abstract interface, - so that any subclass which implements it is searchable. +/** + IndexReader is an abstract class, providing an interface for accessing a + point-in-time view of an index. Any changes made to the index + via {@link IndexWriter} will not be visible until a new + {@code IndexReader} is opened. It's best to use {@link + DirectoryReader#open(IndexWriter,boolean)} to obtain an + {@code IndexReader}, if your {@link IndexWriter} is + in-process. When you need to re-open to see changes to the + index, it's best to use {@link DirectoryReader#openIfChanged(DirectoryReader)} + since the new reader will share resources with the previous + one when possible. Search of an index is done entirely + through this abstract interface, so that any subclass which + implements it is searchable.

There are two different types of IndexReaders: