public class Lucene
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.lucene.search.ScoreDoc[] |
EMPTY_SCORE_DOCS |
static org.apache.lucene.search.TopDocs |
EMPTY_TOP_DOCS |
static NamedAnalyzer |
KEYWORD_ANALYZER |
static java.lang.String |
LATEST_CODEC |
static java.lang.String |
LATEST_DOC_VALUES_FORMAT |
static java.lang.String |
LATEST_POSTINGS_FORMAT |
static NamedAnalyzer |
STANDARD_ANALYZER |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.lucene.util.Bits |
asSequentialAccessBits(int maxDoc,
org.apache.lucene.search.ScorerSupplier scorerSupplier)
Given a
ScorerSupplier, return a Bits instance that will match
all documents contained in the set. |
static void |
checkSegmentInfoIntegrity(org.apache.lucene.store.Directory directory) |
static void |
cleanLuceneIndex(org.apache.lucene.store.Directory directory)
This method removes all lucene files from the given directory.
|
static boolean |
exists(org.apache.lucene.search.IndexSearcher searcher,
org.apache.lucene.search.Query query)
Check whether there is one or more documents matching the provided query.
|
static java.lang.Iterable<java.lang.String> |
files(org.apache.lucene.index.SegmentInfos infos)
Returns an iterable that allows to iterate over all files in this segments info
|
static int |
getNumDocs(org.apache.lucene.index.SegmentInfos info)
Returns the number of documents in the index referenced by this
SegmentInfos |
static org.apache.lucene.search.Scorer |
illegalScorer(java.lang.String message)
Return a Scorer that throws an ElasticsearchIllegalStateException
on all operations with the given message.
|
static boolean |
indexExists(org.apache.lucene.store.Directory directory) |
static boolean |
isCorruptionException(java.lang.Throwable t)
Returns true iff the given exception or
one of it's causes is an instance of
CorruptIndexException,
IndexFormatTooOldException, or IndexFormatTooNewException otherwise false. |
static org.apache.lucene.util.Version |
parseVersion(java.lang.String version,
org.apache.lucene.util.Version defaultVersion,
org.apache.logging.log4j.Logger logger) |
static org.apache.lucene.util.Version |
parseVersionLenient(java.lang.String toParse,
org.apache.lucene.util.Version defaultValue)
Parses the version string lenient and returns the default value if the given string is null or empty
|
static org.apache.lucene.index.SegmentInfos |
pruneUnreferencedFiles(java.lang.String segmentsFileName,
org.apache.lucene.store.Directory directory)
This method removes all files from the given directory that are not referenced by the given segments file.
|
static org.apache.lucene.search.Explanation |
readExplanation(StreamInput in) |
static org.apache.lucene.search.FieldDoc |
readFieldDoc(StreamInput in) |
static org.apache.lucene.search.ScoreDoc |
readScoreDoc(StreamInput in) |
static org.apache.lucene.index.SegmentInfos |
readSegmentInfos(org.apache.lucene.store.Directory directory)
Reads the segments infos, failing if it fails to load
|
static org.apache.lucene.index.SegmentInfos |
readSegmentInfos(org.apache.lucene.index.IndexCommit commit)
Reads the segments infos from the given commit, failing if it fails to load
|
static org.apache.lucene.search.SortField |
readSortField(StreamInput in) |
static org.apache.lucene.search.SortField.Type |
readSortType(StreamInput in) |
static org.apache.lucene.search.TopDocs |
readTopDocs(StreamInput in) |
static org.apache.lucene.index.SegmentReader |
segmentReader(org.apache.lucene.index.LeafReader reader)
Tries to extract a segment reader from the given index reader.
|
static boolean |
waitForIndex(org.apache.lucene.store.Directory directory,
long timeLimitMillis)
Wait for an index to exist for up to
timeLimitMillis. |
static void |
writeExplanation(StreamOutput out,
org.apache.lucene.search.Explanation explanation) |
static void |
writeFieldDoc(StreamOutput out,
org.apache.lucene.search.FieldDoc fieldDoc) |
static void |
writeScoreDoc(StreamOutput out,
org.apache.lucene.search.ScoreDoc scoreDoc) |
static void |
writeSortField(StreamOutput out,
org.apache.lucene.search.SortField sortField) |
static void |
writeSortType(StreamOutput out,
org.apache.lucene.search.SortField.Type sortType) |
static void |
writeTopDocs(StreamOutput out,
org.apache.lucene.search.TopDocs topDocs) |
public static final java.lang.String LATEST_DOC_VALUES_FORMAT
public static final java.lang.String LATEST_POSTINGS_FORMAT
public static final java.lang.String LATEST_CODEC
public static final NamedAnalyzer STANDARD_ANALYZER
public static final NamedAnalyzer KEYWORD_ANALYZER
public static final org.apache.lucene.search.ScoreDoc[] EMPTY_SCORE_DOCS
public static final org.apache.lucene.search.TopDocs EMPTY_TOP_DOCS
public static org.apache.lucene.util.Version parseVersion(@Nullable java.lang.String version, org.apache.lucene.util.Version defaultVersion, org.apache.logging.log4j.Logger logger)
public static org.apache.lucene.index.SegmentInfos readSegmentInfos(org.apache.lucene.store.Directory directory)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.Iterable<java.lang.String> files(org.apache.lucene.index.SegmentInfos infos)
throws java.io.IOException
java.io.IOExceptionpublic static int getNumDocs(org.apache.lucene.index.SegmentInfos info)
SegmentInfospublic static org.apache.lucene.index.SegmentInfos readSegmentInfos(org.apache.lucene.index.IndexCommit commit)
throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.index.SegmentInfos pruneUnreferencedFiles(java.lang.String segmentsFileName,
org.apache.lucene.store.Directory directory)
throws java.io.IOException
java.io.IOExceptionpublic static void cleanLuceneIndex(org.apache.lucene.store.Directory directory)
throws java.io.IOException
java.io.IOExceptionpublic static void checkSegmentInfoIntegrity(org.apache.lucene.store.Directory directory)
throws java.io.IOException
java.io.IOExceptionpublic static boolean exists(org.apache.lucene.search.IndexSearcher searcher,
org.apache.lucene.search.Query query)
throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.TopDocs readTopDocs(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.FieldDoc readFieldDoc(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.ScoreDoc readScoreDoc(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static void writeTopDocs(StreamOutput out, org.apache.lucene.search.TopDocs topDocs) throws java.io.IOException
java.io.IOExceptionpublic static void writeFieldDoc(StreamOutput out, org.apache.lucene.search.FieldDoc fieldDoc) throws java.io.IOException
java.io.IOExceptionpublic static void writeScoreDoc(StreamOutput out, org.apache.lucene.search.ScoreDoc scoreDoc) throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.SortField.Type readSortType(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.SortField readSortField(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static void writeSortType(StreamOutput out, org.apache.lucene.search.SortField.Type sortType) throws java.io.IOException
java.io.IOExceptionpublic static void writeSortField(StreamOutput out, org.apache.lucene.search.SortField sortField) throws java.io.IOException
java.io.IOExceptionpublic static org.apache.lucene.search.Explanation readExplanation(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static void writeExplanation(StreamOutput out, org.apache.lucene.search.Explanation explanation) throws java.io.IOException
java.io.IOExceptionpublic static final boolean indexExists(org.apache.lucene.store.Directory directory)
throws java.io.IOException
java.io.IOExceptionpublic static final boolean waitForIndex(org.apache.lucene.store.Directory directory,
long timeLimitMillis)
throws java.io.IOException
timeLimitMillis. Returns
true if the index eventually exists, false if not.
Will retry the directory every second for at least timeLimitMillisjava.io.IOExceptionpublic static boolean isCorruptionException(java.lang.Throwable t)
CorruptIndexException,
IndexFormatTooOldException, or IndexFormatTooNewException otherwise false.public static org.apache.lucene.util.Version parseVersionLenient(java.lang.String toParse,
org.apache.lucene.util.Version defaultValue)
public static org.apache.lucene.index.SegmentReader segmentReader(org.apache.lucene.index.LeafReader reader)
IllegalStateException is thrown.public static org.apache.lucene.search.Scorer illegalScorer(java.lang.String message)
public static org.apache.lucene.util.Bits asSequentialAccessBits(int maxDoc,
@Nullable
org.apache.lucene.search.ScorerSupplier scorerSupplier)
throws java.io.IOException
ScorerSupplier, return a Bits instance that will match
all documents contained in the set. Note that the returned Bits
instance MUST be consumed in order.java.io.IOException