Changeset 327
- Timestamp:
- 03/07/08 05:15:27 (9 months ago)
- Location:
- trunk/thrudex/src
- Files:
-
- 3 modified
-
CLuceneIndex.cpp (modified) (2 diffs)
-
CLuceneIndex.h (modified) (1 diff)
-
CLuceneRAMDirectory.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thrudex/src/CLuceneIndex.cpp
r325 r327 155 155 if(last_refresh < last_modified || last_refresh < last_synched){ 156 156 157 157 158 modifier->flush(); 158 159 159 ram_searcher.reset(new IndexSearcher( ram_directory.get() )); 160 161 ram_searcher.reset(); 162 163 //make a copy of the ram dir since its not thread safe 164 ram_readonly_directory = shared_ptr<CLuceneRAMDirectory>(new CLuceneRAMDirectory( ram_directory.get() )); 165 ram_readonly_directory->__cl_addref(); //trick clucene's lame ref counters 166 167 ram_searcher.reset(new IndexSearcher( ram_readonly_directory.get() )); 168 160 169 161 170 //since clucene doesn't use shared_ptr we need to get the … … 282 291 } 283 292 284 293 shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory; 294 shared_ptr<CLuceneRAMDirectory> l_ram_directory; 295 shared_ptr<CLuceneRAMDirectory> l_ram_prev_directory; 296 shared_ptr<IndexSearcher> l_ram_searcher; 297 shared_ptr<IndexSearcher> l_ram_prev_searcher; 298 shared_ptr<IndexSearcher> l_disk_searcher; 299 shared_ptr<UpdateFilter> l_disk_filter; 300 shared_ptr<MultiSearcher> l_searcher; 285 301 //RWGuard g(mutex); 286 Guard g(mutex); 287 288 289 //making sure references to underlying objects stay above 0 290 //for the duration of this function 291 shared_ptr<CLuceneRAMDirectory> l_ram_directory = ram_directory; 292 shared_ptr<CLuceneRAMDirectory> l_ram_prev_directory = ram_prev_directory; 293 shared_ptr<IndexSearcher> l_ram_searcher = ram_searcher; 294 shared_ptr<IndexSearcher> l_ram_prev_searcher = ram_prev_searcher; 295 shared_ptr<IndexSearcher> l_disk_searcher = disk_searcher; 296 297 298 shared_ptr<MultiSearcher> l_searcher = this->getSearcher(); 299 shared_ptr<UpdateFilter> l_disk_filter = disk_filter; 302 { 303 Guard g(mutex); 304 305 l_searcher = this->getSearcher(); 306 307 //making sure references to underlying objects stay above 0 308 //for the duration of this function 309 l_ram_readonly_directory = ram_readonly_directory; 310 l_ram_directory = ram_directory; 311 l_ram_prev_directory = ram_prev_directory; 312 l_ram_searcher = ram_searcher; 313 l_ram_prev_searcher = ram_prev_searcher; 314 l_disk_searcher = disk_searcher; 315 316 l_disk_filter = disk_filter; 317 318 } 300 319 301 320 Query *query; -
trunk/thrudex/src/CLuceneIndex.h
r325 r327 91 91 boost::shared_ptr<lucene::store::CLuceneRAMDirectory> ram_prev_directory; 92 92 boost::shared_ptr<lucene::store::CLuceneRAMDirectory> ram_prev_prev_directory; 93 boost::shared_ptr<lucene::store::CLuceneRAMDirectory> ram_readonly_directory; 93 94 94 95 boost::shared_ptr<lucene::search::IndexSearcher> ram_searcher; -
trunk/thrudex/src/CLuceneRAMDirectory.cpp
r264 r327 103 103 } 104 104 105 106 105 107 // graceful cleanup 106 108 is->close(); … … 109 111 _CLDELETE(os); 110 112 } 113 111 114 if (closeDir) 112 115 dir->close();
