Lucene++ - a full-featured, c++ search engine
API Documentation


FieldCacheSanityChecker.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef FIELDCACHESANITYCHECKER_H
8 #define FIELDCACHESANITYCHECKER_H
9 
10 #include "LuceneObject.h"
11 #include "MapOfSets.h"
12 
13 namespace Lucene {
14 
28 class LPPAPI FieldCacheSanityChecker : public LuceneObject {
29 public:
32 
34 
35 public:
36  typedef MapOfSets< int32_t, boost::hash<int32_t>, std::equal_to<int32_t>, FieldCacheEntryPtr, luceneHash<FieldCacheEntryPtr>, luceneEquals<FieldCacheEntryPtr> > MapSetIntFieldCacheEntry;
37  typedef MapOfSets< ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr>, int32_t, boost::hash<int32_t>, std::equal_to<int32_t> > MapSetReaderFieldInt;
38  typedef MapOfSets< ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr>, ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr> > MapSetReaderFieldReaderField;
39 
41  enum InsanityType {
44 
54 
57  EXPECTED
58  };
59 
63 
68 
72 
73 protected:
78  MapSetReaderFieldInt readerFieldToValIds,
79  SetReaderField valMismatchKeys);
80 
86  MapSetReaderFieldInt readerFieldToValIds);
87 
91 };
92 
95 class LPPAPI Insanity : public LuceneObject {
96 public:
98  virtual ~Insanity();
99 
101 
102 protected:
104  String msg;
106 
107 public:
110 
112  String getMsg();
113 
116 
119  virtual String toString();
120 };
121 
122 }
123 
124 #endif
Lucene::FieldCacheSanityChecker::~FieldCacheSanityChecker
virtual ~FieldCacheSanityChecker()
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Insanity
Simple container for a collection of related CacheEntry objects that in conjunction with each other r...
Definition: FieldCacheSanityChecker.h:95
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
Lucene::Insanity::getType
FieldCacheSanityChecker::InsanityType getType()
Type of insane behavior this object represents.
Lucene::FieldCacheEntryPtr
boost::shared_ptr< FieldCacheEntry > FieldCacheEntryPtr
Definition: LuceneTypes.h:336
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::FieldCacheSanityChecker::SUBREADER
@ SUBREADER
Indicates an overlap in cache usage on a given field in sub/super readers.
Definition: FieldCacheSanityChecker.h:43
Lucene::FieldCacheSanityChecker::checkValueMismatch
Collection< InsanityPtr > checkValueMismatch(MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds, SetReaderField valMismatchKeys)
Internal helper method used by check that iterates over valMismatchKeys and generates a Collection of...
Lucene::FieldCacheSanityChecker::MapSetReaderFieldInt
MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, int32_t, boost::hash< int32_t >, std::equal_to< int32_t > > MapSetReaderFieldInt
Definition: FieldCacheSanityChecker.h:37
Lucene::Insanity::getCacheEntries
Collection< FieldCacheEntryPtr > getCacheEntries()
CacheEntry objects which suggest a problem.
Lucene::FieldCacheSanityChecker::InsanityType
InsanityType
An Enumeration of the different types of "insane" behaviour that may be detected in a FieldCache.
Definition: FieldCacheSanityChecker.h:41
Lucene::Insanity::toString
virtual String toString()
Multi-Line representation of this Insanity object, starting with the Type and Msg,...
Lucene::FieldCacheSanityChecker::getAllDecendentReaderKeys
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 l...
Lucene::Insanity::entries
Collection< FieldCacheEntryPtr > entries
Definition: FieldCacheSanityChecker.h:105
Lucene::Insanity::~Insanity
virtual ~Insanity()
Lucene::Insanity::getMsg
String getMsg()
Description of the insane behaviour.
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::ReaderFieldPtr
boost::shared_ptr< ReaderField > ReaderFieldPtr
Definition: LuceneTypes.h:548
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::Insanity::msg
String msg
Definition: FieldCacheSanityChecker.h:104
Lucene::Insanity::type
FieldCacheSanityChecker::InsanityType type
Definition: FieldCacheSanityChecker.h:100
MapOfSets.h
Lucene::MapOfSets
Helper class for keeping Lists of Objects associated with keys.
Definition: MapOfSets.h:16
Lucene::FieldCacheSanityChecker::checkSanity
static Collection< InsanityPtr > checkSanity(const FieldCachePtr &cache)
Quick and dirty convenience method.
Lucene::FieldCacheSanityChecker
Provides methods for sanity checking that entries in the FieldCache are not wasteful or inconsistent.
Definition: FieldCacheSanityChecker.h:28
Lucene::FieldCacheSanityChecker::MapSetReaderFieldReaderField
MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr > > MapSetReaderFieldReaderField
Definition: FieldCacheSanityChecker.h:38
Lucene::Insanity::Insanity
Insanity(FieldCacheSanityChecker::InsanityType type, const String &msg, Collection< FieldCacheEntryPtr > entries)
Lucene::FieldCachePtr
boost::shared_ptr< FieldCache > FieldCachePtr
Definition: LuceneTypes.h:334
Lucene::FieldCacheSanityChecker::FieldCacheSanityChecker
FieldCacheSanityChecker()
Lucene::FieldCacheSanityChecker::VALUEMISMATCH
@ VALUEMISMATCH
Indicates entries have the same reader+fieldname but different cached values. This can happen if diff...
Definition: FieldCacheSanityChecker.h:53
Lucene::FieldCacheSanityChecker::MapSetIntFieldCacheEntry
MapOfSets< int32_t, boost::hash< int32_t >, std::equal_to< int32_t >, FieldCacheEntryPtr, luceneHash< FieldCacheEntryPtr >, luceneEquals< FieldCacheEntryPtr > > MapSetIntFieldCacheEntry
Definition: FieldCacheSanityChecker.h:33
Lucene::FieldCacheSanityChecker::checkSubreaders
Collection< InsanityPtr > checkSubreaders(MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds)
Internal helper method used by check that iterates over the keys of readerFieldToValIds and generates...
Lucene::FieldCacheSanityChecker::checkSanity
static Collection< InsanityPtr > checkSanity(Collection< FieldCacheEntryPtr > cacheEntries)
Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to ...
Lucene::FieldCacheSanityChecker::check
Collection< InsanityPtr > check(Collection< FieldCacheEntryPtr > cacheEntries)
Tests a CacheEntry[] for indication of "insane" cache usage. NOTE: FieldCache CreationPlaceholder obj...
LuceneObject.h

clucene.sourceforge.net