Package org.apache.lucene.store
Class IOContext
java.lang.Object
org.apache.lucene.store.IOContext
IOContext holds additional details on the merge/search context. A IOContext object can never be
initialized as null as passed as a parameter to either
Directory.openInput(String, IOContext)
or Directory.createOutput(String, IOContext)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Context is a enumerator which specifies the context in which the Directory is being used for. -
Field Summary
Modifier and TypeFieldDescriptionfinal IOContext.Context
An object of a enumerator Context typestatic final IOContext
final FlushInfo
final boolean
This flag is used for files that are a small fraction of the total index size and are expected to be heavily accessed in random-access fashion.static final IOContext
final MergeInfo
static final IOContext
final boolean
This flag indicates that the file will be accessed randomly.static final IOContext
final boolean
This flag indicates that the file will be opened, then fully read sequentially then closed.static final IOContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
toString()
Return an updatedIOContext
that hasrandomAccess
set to true ifcontext
isIOContext.Context.READ
orIOContext.Context.DEFAULT
.
-
Field Details
-
context
An object of a enumerator Context type -
mergeInfo
-
flushInfo
-
readOnce
public final boolean readOnceThis flag indicates that the file will be opened, then fully read sequentially then closed. -
randomAccess
public final boolean randomAccessThis flag indicates that the file will be accessed randomly. If this flag is set, then readOnce will be false. -
load
public final boolean loadThis flag is used for files that are a small fraction of the total index size and are expected to be heavily accessed in random-access fashion. SomeDirectory
implementations may choose to load such files into physical memory (e.g. Java heap) as a way to provide stronger guarantees on query latency. If this flag is set, thenrandomAccess
will be true. -
DEFAULT
-
READONCE
-
READ
-
LOAD
-
RANDOM
-
-
Constructor Details
-
IOContext
public IOContext() -
IOContext
-
IOContext
-
IOContext
-
IOContext
This constructor is used to initialize aIOContext
instance with a new value for the readOnce variable. This automatically setsrandomAccess
andload
tofalse
.
-
-
Method Details
-
withRandomAccess
Return an updatedIOContext
that hasrandomAccess
set to true ifcontext
isIOContext.Context.READ
orIOContext.Context.DEFAULT
. Otherwise, this returns this instance. This helps preserve sequential access for merging, which is always the right choice, while allowingIndexInput
s open for searching to use random access. -
hashCode
public int hashCode() -
equals
-
toString
-