Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

FieldStatistics.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 
00013 //
00014 // FieldStatistics
00015 //
00016 // 4 February 2004 -- tds
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, bool ordinal, bool parental )
00026         :
00027         name(_name),
00028         isNumeric(numeric),
00029         isOrdinal(ordinal),
00030         isParental(parental),
00031         totalCount(0),
00032         documentCount(0),
00033         lastDocument(0),
00034         lastCount(0),
00035         byteOffset(0)
00036       {
00037       }
00038 
00039       FieldStatistics( const std::string& _name, bool numeric, bool ordinal, bool parental, UINT64 _totalCount, unsigned int _documentCount, UINT64 _byteOffset )
00040         :
00041         name(_name),
00042         isNumeric(numeric),
00043         isOrdinal(ordinal),
00044         isParental(parental),
00045         totalCount(_totalCount),
00046         documentCount(_documentCount),
00047         lastDocument(0),
00048         lastCount(0), 
00049         byteOffset(_byteOffset)
00050       {
00051       }
00052 
00053       void addOccurrence( lemur::api::DOCID_T documentID ) {
00054         if( documentID != lastDocument ) {
00055           lastCount = 0;
00056           lastDocument = documentID;
00057           documentCount++;
00058         }
00059 
00060         totalCount++;
00061         lastCount++;
00062       }
00063       
00064       std::string name;
00065       bool isNumeric;
00066       bool isOrdinal;
00067       bool isParental;
00068       UINT64 totalCount;
00069       unsigned int documentCount;
00070       UINT64 byteOffset;
00071 
00072       lemur::api::DOCID_T lastDocument;
00073       int lastCount;
00074     };
00075   }
00076 }
00077 
00078 #endif // INDRI_FIELDSTATISTICS_HPP
00079 

Generated on Tue Jun 15 11:02:54 2010 for Lemur by doxygen 1.3.4