Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Repository.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 // Repository
00015 //
00016 // 21 May 2004 -- tds
00017 //
00018 
00019 #ifndef INDRI_REPOSITORY_HPP
00020 #define INDRI_REPOSITORY_HPP
00021 
00022 #include "indri/Parameters.hpp"
00023 #include "indri/Transformation.hpp"
00024 #include <string>
00025 
00029 class Repository {
00030 public:
00031   struct Field {
00032     std::string name;
00033     std::string parserName;
00034     bool numeric;
00035   };
00036 
00037 private:
00038   class IndriIndex* _index;
00039   class CompressedCollection* _collection;
00040   Parameters _parameters;
00041   std::vector<Transformation*> _transformations;
00042   std::vector<Field> _fields;
00043 
00044   std::string _path;
00045   bool _readOnly;
00046 
00047   void _buildFields();
00048   void _buildChain();
00049   void _buildTransientChain( Parameters& parameters );
00050 
00051   void _copyParameters( Parameters& options );
00052 
00053 public:
00054   Repository() {
00055     _index = 0;
00056     _collection = 0;
00057     _readOnly = false;
00058   }
00059 
00060   ~Repository() {
00061     close();
00062   }
00065   void addDocument( ParsedDocument* document );
00067   const std::vector<Field>& fields() const;
00069   std::vector<std::string> tags() const;
00073   std::string processTerm( const std::string& term );
00075   class CompressedCollection* collection();
00077   class IndriIndex* index();
00081   void create( const std::string& path, Parameters* options = 0 );
00085   void open( const std::string& path, Parameters* options = 0 );
00089   void openRead( const std::string& path, Parameters* options = 0 );
00093   static bool exists( const std::string& path );
00095   void close();
00096 };
00097 
00098 #endif // INDRI_REPOSITORY_HPP
00099 

Generated on Wed Nov 3 12:59:03 2004 for Lemur Toolkit by doxygen1.2.18