public class IndexConsistencyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isIndexConsistent(String name,
int expectedCount,
org.apache.lucene.search.IndexSearcher searcher)
Performs a simple consistency check on an index by opening it, comparing the document count to an expected value
supplied by the caller, and closing it.
|
public static boolean isIndexConsistent(String name, int expectedCount, org.apache.lucene.search.IndexSearcher searcher) throws IOException
-1 may be specified to skip that part of the check. If an expected count is given, the
actual count must be within 10% of the expected value or 10 documents, whichever value is
larger.
name - a name to identify the indexexpectedCount - the expected count of documents in the index, or -1 to skip this checksearcher - index searchertrue if the index is present and contains reasonably close to the expected number of documents;
false if any exception is thrown or if the index document count is excessively different from the
expected countIOExceptionCopyright © 2002-2022 Atlassian. All Rights Reserved.