Lucene++ - a full-featured, c++ search engine
API Documentation
Provides methods for sanity checking that entries in the FieldCache are not wasteful or inconsistent. More...
#include <FieldCacheSanityChecker.h>
Public Types | |
enum | InsanityType { SUBREADER , VALUEMISMATCH , EXPECTED } |
An Enumeration of the different types of "insane" behaviour that may be detected in a FieldCache. More... | |
typedef MapOfSets< int32_t, boost::hash< int32_t >, std::equal_to< int32_t >, FieldCacheEntryPtr, luceneHash< FieldCacheEntryPtr >, luceneEquals< FieldCacheEntryPtr > > | MapSetIntFieldCacheEntry |
typedef MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, int32_t, boost::hash< int32_t >, std::equal_to< int32_t > > | MapSetReaderFieldInt |
typedef MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr > > | MapSetReaderFieldReaderField |
Public Member Functions | |
FieldCacheSanityChecker () | |
virtual | ~FieldCacheSanityChecker () |
virtual String | getClassName () |
boost::shared_ptr< FieldCacheSanityChecker > | shared_from_this () |
Collection< InsanityPtr > | check (Collection< FieldCacheEntryPtr > cacheEntries) |
Tests a CacheEntry[] for indication of "insane" cache usage. NOTE: FieldCache CreationPlaceholder objects are ignored. | |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. | |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Return clone of this object. | |
virtual int32_t | hashCode () |
Return hash code for this object. | |
virtual bool | equals (const LuceneObjectPtr &other) |
Return whether two objects are equal. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
virtual String | toString () |
Returns a string representation of the object. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
static Collection< InsanityPtr > | checkSanity (const FieldCachePtr &cache) |
Quick and dirty convenience method. | |
static Collection< InsanityPtr > | checkSanity (Collection< FieldCacheEntryPtr > cacheEntries) |
Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to test the CacheEntrys. | |
Protected Member Functions | |
Collection< InsanityPtr > | checkValueMismatch (MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds, SetReaderField valMismatchKeys) |
Internal helper method used by check that iterates over valMismatchKeys and generates a Collection of Insanity instances accordingly. The MapOfSets are used to populate the Insanity objects. | |
Collection< InsanityPtr > | checkSubreaders (MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds) |
Internal helper method used by check that iterates over the keys of readerFieldToValIds and generates a Collection of Insanity instances whenever two (or more) ReaderField instances are found that have an ancestry relationships. | |
Collection< LuceneObjectPtr > | getAllDecendentReaderKeys (const LuceneObjectPtr &seed) |
Checks if the seed is an IndexReader, and if so will walk the hierarchy of subReaders building up a list of the objects returned by obj.getFieldCacheKey() | |
![]() | |
LuceneObject () | |
Additional Inherited Members | |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
Provides methods for sanity checking that entries in the FieldCache are not wasteful or inconsistent.
Lucene 2.9 Introduced numerous enhancements into how the FieldCache is used by the low levels of Lucene searching (for Sorting and ValueSourceQueries) to improve both the speed for Sorting, as well as reopening of IndexReaders. But these changes have shifted the usage of FieldCache from "top level" IndexReaders (frequently a MultiReader or DirectoryReader) down to the leaf level SegmentReaders. As a result, existing applications that directly access the FieldCache may find RAM usage increase significantly when upgrading to 2.9 or later. This class provides an API for these applications (or their Unit tests) to check at run time if the FieldCache contains "insane" usages of the FieldCache.
typedef MapOfSets< int32_t, boost::hash<int32_t>, std::equal_to<int32_t>, FieldCacheEntryPtr, luceneHash<FieldCacheEntryPtr>, luceneEquals<FieldCacheEntryPtr> > Lucene::FieldCacheSanityChecker::MapSetIntFieldCacheEntry |
typedef MapOfSets< ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr>, int32_t, boost::hash<int32_t>, std::equal_to<int32_t> > Lucene::FieldCacheSanityChecker::MapSetReaderFieldInt |
typedef MapOfSets< ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr>, ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr> > Lucene::FieldCacheSanityChecker::MapSetReaderFieldReaderField |
An Enumeration of the different types of "insane" behaviour that may be detected in a FieldCache.
Enumerator | |
---|---|
SUBREADER | Indicates an overlap in cache usage on a given field in sub/super readers. |
VALUEMISMATCH | Indicates entries have the same reader+fieldname but different cached values. This can happen if different datatypes, or parsers are used – and while it's not necessarily a bug it's typically an indication of a possible problem. NOTE: Only the reader, fieldname, and cached value are actually tested – if two cache entries have different parsers or datatypes but the cached values are the same Object (== not just equal()) this method does not consider that a red flag. This allows for subtle variations in the way a Parser is specified (null vs DEFAULT_LONG_PARSER, etc...) |
EXPECTED | Indicates an expected bit of "insanity". This may be useful for clients that wish to preserve/log information about insane usage but indicate that it was expected. |
Lucene::FieldCacheSanityChecker::FieldCacheSanityChecker | ( | ) |
|
virtual |
|
inlinestatic |
Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::check | ( | Collection< FieldCacheEntryPtr > | cacheEntries | ) |
Tests a CacheEntry[] for indication of "insane" cache usage. NOTE: FieldCache CreationPlaceholder objects are ignored.
|
static |
Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to test the CacheEntrys.
|
static |
Quick and dirty convenience method.
|
protected |
Internal helper method used by check that iterates over the keys of readerFieldToValIds and generates a Collection of Insanity instances whenever two (or more) ReaderField instances are found that have an ancestry relationships.
|
protected |
Internal helper method used by check that iterates over valMismatchKeys and generates a Collection of Insanity instances accordingly. The MapOfSets are used to populate the Insanity objects.
|
protected |
Checks if the seed is an IndexReader, and if so will walk the hierarchy of subReaders building up a list of the objects returned by obj.getFieldCacheKey()
|
inlinevirtual |
|
inline |