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 // KeyfileDocListDiskBuilder.hpp 00015 // 00016 00017 #ifndef INDRI_DOCLISTDISKBUILDER_HPP 00018 #define INDRI_DOCLISTDISKBUILDER_HPP 00019 00020 #include "WriteBuffer.hpp" 00021 #include "RVLCompress.hpp" 00022 #include "ReadBuffer.hpp" 00023 #include "File.hpp" 00024 00025 #include "indri/DocListIterator.hpp" 00026 #include "indri/DocListDiskBlockWriter.hpp" 00027 #include "indri/DocListFileIterator.hpp" 00028 #include "indri/DocListDiskBlockReader.hpp" 00029 00030 namespace indri { 00031 namespace index { 00032 class DocListDiskBuilder { 00033 private: 00034 File::offset_type _blockCount; 00035 WriteBuffer& _writeBuffer; 00036 DocListDiskBlockWriter _block; 00037 00038 public: 00039 DocListDiskBuilder( WriteBuffer& buffer ); 00040 void addLocation( int termID, int documentID, int location ); 00041 void addDocument( int termID, int documentID, const int* locations, int locationCount ); 00042 File::offset_type currentBlock(); 00043 void flush(); 00044 }; 00045 } 00046 } 00047 00048 #endif // INDRI_DOCLISTDISKBUILDER_HPP