public interface IndexReaderAccessor
IndexReaderAccessor
exposes IndexReader
s directly, making it possible to query the Lucene
indexes directly bypassing Hibernate Search.
The returned IndexReader instances are always read-only and must be closed
using the close(IndexReader)
method on this same instance.
Note: this API is intended for power users intending to extract information directly.
Modifier and Type | Method and Description |
---|---|
void |
close(IndexReader indexReader)
Closes IndexReader instances obtained using
open(Class...) |
IndexReader |
open(Class<?>... entities)
Opens an IndexReader on all indexes containing the entities passed as parameter.
|
IndexReader |
open(String... indexNames)
Opens an IndexReader on all named indexes.
|
IndexReader open(Class<?>... entities)
The returned IndexReader is read only; writing directly to the index is discouraged. If you
need to write to the index use the
SearchIntegrator.getWorker()
to queue change operations to the backend.
The IndexReader should not be closed in other ways except being returned to this instance via
close(IndexReader)
.
entities
- the entity types for which to return a (multi)readerIllegalArgumentException
- if one of the specified classes is not indexedIndexReader open(String... indexNames)
indexNames
- At least one IndexManager name.SearchException
- if the index manager to which the named index belongs failed to startvoid close(IndexReader indexReader)
open(Class...)
indexReader
- the IndexReader to be closedCopyright © 2006-2017 Red Hat, Inc. All Rights Reserved