Changeset 362
- Timestamp:
- 04/26/08 20:32:35 (7 months ago)
- Location:
- trunk/thrudex/src
- Files:
-
- 3 modified
-
CLuceneBackend.cpp (modified) (4 diffs)
-
CLuceneIndex.cpp (modified) (3 diffs)
-
CLuceneIndex.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thrudex/src/CLuceneBackend.cpp
r350 r362 6 6 7 7 #include "CLuceneBackend.h" 8 #include "ConfigFile.h" 8 9 #include "utils.h" 9 10 #include <boost/filesystem.hpp> … … 86 87 return; 87 88 89 size_t filter_space = ConfigManager->read<int>("FILTER_SPACE_SIZE",1000000); 90 88 91 index_cache[index] = 89 shared_ptr<CLuceneIndex>(new CLuceneIndex(idx_root,index, analyzer));92 shared_ptr<CLuceneIndex>(new CLuceneIndex(idx_root,index,filter_space,analyzer)); 90 93 } 91 94 … … 101 104 throw ex; 102 105 } 103 104 106 105 107 lucene::document::Document *doc = new lucene::document::Document(); … … 240 242 } else if (op == "put_log_position") { 241 243 fs::ofstream outfile; 242 outfile.open( log_pos_file.c_str (), 244 outfile.open( log_pos_file.c_str (), 243 245 ios::out | ios::binary | ios::trunc); 244 246 if (!outfile.is_open ()) -
trunk/thrudex/src/CLuceneIndex.cpp
r349 r362 46 46 }; 47 47 48 CLuceneIndex::CLuceneIndex(const string &index_root, const string &index_name, shared_ptr<Analyzer> analyzer)49 : index_root(index_root), index_name(index_name), analyzer(analyzer), filter_space( 10000000), last_synched(0), syncing(false)48 CLuceneIndex::CLuceneIndex(const string &index_root, const string &index_name, const size_t &filter_space, shared_ptr<Analyzer> analyzer) 49 : index_root(index_root), index_name(index_name), analyzer(analyzer), filter_space(filter_space), last_synched(0), syncing(false) 50 50 { 51 51 … … 167 167 168 168 modifier->flush(); 169 169 170 170 ram_searcher.reset(); 171 171 172 //shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory = ram_readonly_directory;172 //shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory = ram_readonly_directory; 173 173 174 174 //make a copy of the ram dir since its not thread safe … … 186 186 if(syncing){ 187 187 //make a copy of the ram dir since its not thread safe 188 ram_readonly_prev_directory = shared_ptr<CLuceneRAMDirectory>(new CLuceneRAMDirectory( ram_prev_directory.get() ), null_deleter() );189 ram_readonly_prev_directory->__cl_addref(); //trick clucene's lame ref counters188 ram_readonly_prev_directory = shared_ptr<CLuceneRAMDirectory>(new CLuceneRAMDirectory( ram_prev_directory.get() ), null_deleter() ); 189 ram_readonly_prev_directory->__cl_addref(); //trick clucene's lame ref counters 190 190 191 191 ram_prev_searcher.reset(new IndexSearcher( ram_readonly_prev_directory.get() )); -
trunk/thrudex/src/CLuceneIndex.h
r347 r362 47 47 CLuceneIndex(const std::string &index_root, 48 48 const std::string &index_name, 49 const std::size_t &filter_space, 49 50 boost::shared_ptr<lucene::analysis::Analyzer> analyzer); 50 51 … … 64 65 65 66 static log4cxx::LoggerPtr logger; 66 facebook::thrift::concurrency::Mutex mutex; 67 //facebook::thrift::concurrency::ReadWriteMutex mutex; 67 facebook::thrift::concurrency::Mutex mutex; 68 68 69 69 const std::string index_root; … … 71 71 boost::shared_ptr<lucene::analysis::Analyzer> analyzer; 72 72 73 int filter_space;73 std::size_t filter_space; 74 74 75 75 boost::shared_ptr<lucene::index::IndexModifier> modifier;
