public class Lucene extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Lucene.EarlyTerminatingCollector
A collector that terminates early by throwing
Lucene.EarlyTerminationException
when count of matched documents has reached maxCountHits |
static class |
Lucene.EarlyTerminationException
This exception is thrown when
Lucene.EarlyTerminatingCollector
reaches early termination |
Modifier and Type | Field and Description |
---|---|
static org.apache.lucene.util.Version |
ANALYZER_VERSION |
static org.apache.lucene.search.ScoreDoc[] |
EMPTY_SCORE_DOCS |
static org.apache.lucene.search.TopDocs |
EMPTY_TOP_DOCS |
static NamedAnalyzer |
KEYWORD_ANALYZER |
static String |
LATEST_CODEC |
static String |
LATEST_DOC_VALUES_FORMAT |
static String |
LATEST_POSTINGS_FORMAT |
static org.apache.lucene.util.Version |
QUERYPARSER_VERSION |
static NamedAnalyzer |
STANDARD_ANALYZER |
static org.apache.lucene.util.Version |
VERSION |
Modifier and Type | Method and Description |
---|---|
static org.apache.lucene.util.Bits |
asSequentialAccessBits(int maxDoc,
org.apache.lucene.search.Scorer scorer)
Given a
Scorer , 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 Iterable<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(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(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 boolean |
isEmpty(org.apache.lucene.search.DocIdSet set)
Is it an empty
DocIdSet ? |
static org.apache.lucene.util.Version |
parseVersion(String version,
org.apache.lucene.util.Version defaultVersion,
ESLogger logger) |
static org.apache.lucene.util.Version |
parseVersionLenient(String toParse,
org.apache.lucene.util.Version defaultValue)
Parses the version string lenient and returns the the default value if the given string is null or emtpy
|
static org.apache.lucene.index.SegmentInfos |
pruneUnreferencedFiles(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.Type |
readSortType(StreamInput in) |
static org.apache.lucene.search.TopDocs |
readTopDocs(StreamInput in) |
static boolean |
waitForIndex(org.apache.lucene.store.Directory directory,
long timeLimitMillis)
Wait for an index to exist for up to
timeLimitMillis . |
static Lucene.EarlyTerminatingCollector |
wrapCountBasedEarlyTerminatingCollector(org.apache.lucene.search.Collector delegate,
int maxCountHits)
Wraps
delegate with count based early termination collector with a threshold of maxCountHits |
static org.apache.lucene.search.TimeLimitingCollector |
wrapTimeLimitingCollector(org.apache.lucene.search.Collector delegate,
org.apache.lucene.util.Counter counter,
long timeoutInMillis)
Wraps
delegate with a time limited collector with a timeout of timeoutInMillis |
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 |
writeSortType(StreamOutput out,
org.apache.lucene.search.SortField.Type sortType) |
static void |
writeTopDocs(StreamOutput out,
org.apache.lucene.search.TopDocs topDocs) |
public static final org.apache.lucene.util.Version VERSION
public static final org.apache.lucene.util.Version ANALYZER_VERSION
public static final org.apache.lucene.util.Version QUERYPARSER_VERSION
public static final String LATEST_DOC_VALUES_FORMAT
public static final String LATEST_POSTINGS_FORMAT
public static final 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 String version, org.apache.lucene.util.Version defaultVersion, ESLogger logger)
public static org.apache.lucene.index.SegmentInfos readSegmentInfos(org.apache.lucene.store.Directory directory) throws IOException
IOException
public static Iterable<String> files(org.apache.lucene.index.SegmentInfos infos) throws IOException
IOException
public static int getNumDocs(org.apache.lucene.index.SegmentInfos info)
SegmentInfos
public static org.apache.lucene.index.SegmentInfos readSegmentInfos(org.apache.lucene.index.IndexCommit commit) throws IOException
IOException
public static org.apache.lucene.index.SegmentInfos pruneUnreferencedFiles(String segmentsFileName, org.apache.lucene.store.Directory directory) throws IOException
IOException
public static void cleanLuceneIndex(org.apache.lucene.store.Directory directory) throws IOException
IOException
public static void checkSegmentInfoIntegrity(org.apache.lucene.store.Directory directory) throws IOException
IOException
public static final Lucene.EarlyTerminatingCollector wrapCountBasedEarlyTerminatingCollector(org.apache.lucene.search.Collector delegate, int maxCountHits)
delegate
with count based early termination collector with a threshold of maxCountHits
public static final org.apache.lucene.search.TimeLimitingCollector wrapTimeLimitingCollector(org.apache.lucene.search.Collector delegate, org.apache.lucene.util.Counter counter, long timeoutInMillis)
delegate
with a time limited collector with a timeout of timeoutInMillis
public static boolean exists(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.Query query) throws IOException
IOException
public static org.apache.lucene.search.TopDocs readTopDocs(StreamInput in) throws IOException
IOException
public static org.apache.lucene.search.FieldDoc readFieldDoc(StreamInput in) throws IOException
IOException
public static org.apache.lucene.search.ScoreDoc readScoreDoc(StreamInput in) throws IOException
IOException
public static void writeTopDocs(StreamOutput out, org.apache.lucene.search.TopDocs topDocs) throws IOException
IOException
public static void writeFieldDoc(StreamOutput out, org.apache.lucene.search.FieldDoc fieldDoc) throws IOException
IOException
public static void writeScoreDoc(StreamOutput out, org.apache.lucene.search.ScoreDoc scoreDoc) throws IOException
IOException
public static org.apache.lucene.search.SortField.Type readSortType(StreamInput in) throws IOException
IOException
public static void writeSortType(StreamOutput out, org.apache.lucene.search.SortField.Type sortType) throws IOException
IOException
public static org.apache.lucene.search.Explanation readExplanation(StreamInput in) throws IOException
IOException
public static void writeExplanation(StreamOutput out, org.apache.lucene.search.Explanation explanation) throws IOException
IOException
public static final boolean indexExists(org.apache.lucene.store.Directory directory) throws IOException
IOException
public static final boolean waitForIndex(org.apache.lucene.store.Directory directory, long timeLimitMillis) throws IOException
timeLimitMillis
. Returns
true if the index eventually exists, false if not.
Will retry the directory every second for at least timeLimitMillis
IOException
public static boolean isCorruptionException(Throwable t)
CorruptIndexException
,
IndexFormatTooOldException
, or IndexFormatTooNewException
otherwise false.public static org.apache.lucene.util.Version parseVersionLenient(String toParse, org.apache.lucene.util.Version defaultValue)
public static org.apache.lucene.search.Scorer illegalScorer(String message)
public static boolean isEmpty(@Nullable org.apache.lucene.search.DocIdSet set)
DocIdSet
?public static org.apache.lucene.util.Bits asSequentialAccessBits(int maxDoc, @Nullable org.apache.lucene.search.Scorer scorer) throws IOException
Scorer
, return a Bits
instance that will match
all documents contained in the set. Note that the returned Bits
instance MUST be consumed in order.IOException
Copyright © 2009–2016. All rights reserved.