00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INDRI_FIELDSTATISTICS_HPP
00020 #define INDRI_FIELDSTATISTICS_HPP
00021
00022 namespace indri {
00023 namespace index {
00024 struct FieldStatistics {
00025 FieldStatistics( const std::string& _name, bool numeric )
00026 :
00027 name(_name),
00028 isNumeric(numeric),
00029 totalCount(0),
00030 documentCount(0),
00031 lastDocument(0),
00032 lastCount(0)
00033 {
00034 }
00035
00036 FieldStatistics( const std::string& _name, bool numeric, INT64 _totalCount, int _documentCount )
00037 :
00038 name(_name),
00039 isNumeric(numeric),
00040 totalCount(_totalCount),
00041 documentCount(_documentCount),
00042 lastDocument(0),
00043 lastCount(0) {
00044 }
00045
00046 void addOccurrence( int documentID ) {
00047 if( documentID != lastDocument ) {
00048 lastCount = 0;
00049 lastDocument = documentID;
00050 documentCount++;
00051 }
00052
00053 totalCount++;
00054 lastCount++;
00055 }
00056
00057 std::string name;
00058 bool isNumeric;
00059 INT64 totalCount;
00060 int documentCount;
00061
00062 int lastDocument;
00063 int lastCount;
00064 };
00065 }
00066 }
00067
00068 #endif // INDRI_FIELDSTATISTICS_HPP
00069