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 // TermFieldStatistics 00015 // 00016 // 4 February 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_TERMFIELDSTATISTICS_HPP 00020 #define INDRI_TERMFIELDSTATISTICS_HPP 00021 00022 #include "lemur-compat.hpp" 00023 #include "IndexTypes.hpp" 00024 00025 namespace indri { 00026 namespace index { 00027 struct TermFieldStatistics { 00028 TermFieldStatistics() : totalCount(0), documentCount(0), lastDocument(0), lastCount(0) {} 00029 00031 UINT64 totalCount; 00032 00034 unsigned int documentCount; 00035 00037 lemur::api::DOCID_T lastDocument; 00038 00040 unsigned int lastCount; 00041 00042 void addOccurrence( lemur::api::DOCID_T documentID ) { 00043 if( lastDocument != documentID ) { 00044 lastDocument = documentID; 00045 lastCount = 0; 00046 documentCount++; 00047 } 00048 00049 totalCount++; 00050 lastCount++; 00051 } 00052 }; 00053 } 00054 } 00055 00056 #endif // INDRI_TERMFIELDSTATISTICS_HPP 00057