Changeset 347

Show
Ignore:
Timestamp:
04/20/08 01:43:58 (7 months ago)
Author:
jake
Message:

hmm another break

Location:
trunk/thrudex/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/thrudex/src/CLuceneIndex.cpp

    r344 r347  
    169169        modifier->flush(); 
    170170 
    171  
    172171        ram_searcher.reset(); 
    173172 
     
    186185 
    187186        if(syncing){ 
    188             ram_prev_searcher.reset(new IndexSearcher( ram_prev_directory.get() )); 
     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() )); 
     189            ram_readonly_prev_directory->__cl_addref(); //trick clucene's lame ref counters 
     190 
     191 
     192            ram_prev_searcher.reset(new IndexSearcher( ram_readonly_prev_directory.get() )); 
    189193            searchers[2] = ram_prev_searcher.get(); 
    190194            searchers[3] = NULL; 
     
    309313    shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory; 
    310314    shared_ptr<CLuceneRAMDirectory> l_ram_directory; 
     315    shared_ptr<CLuceneRAMDirectory> l_ram_readonly_prev_directory; 
    311316    shared_ptr<CLuceneRAMDirectory> l_ram_prev_directory; 
    312317    shared_ptr<IndexSearcher>       l_ram_searcher; 
     
    324329        //making sure references to underlying objects stay above 0 
    325330        //for the duration of this function 
    326         l_ram_readonly_directory  = ram_readonly_directory; 
    327         l_ram_directory      = ram_directory; 
    328         l_ram_prev_directory = ram_prev_directory; 
    329         l_ram_searcher       = ram_searcher; 
    330         l_ram_prev_searcher  = ram_prev_searcher; 
    331         l_disk_searcher      = disk_searcher; 
     331        l_ram_readonly_directory      = ram_readonly_directory; 
     332        l_ram_directory               = ram_directory; 
     333        l_ram_readonly_prev_directory = ram_readonly_prev_directory; 
     334        l_ram_prev_directory          = ram_prev_directory; 
     335        l_ram_searcher                = ram_searcher; 
     336        l_ram_prev_searcher           = ram_prev_searcher; 
     337        l_disk_searcher               = disk_searcher; 
    332338 
    333339        l_disk_filter = disk_filter; 
    334340        l_disk_reader = disk_reader; 
    335  
    336341    } 
    337342 
  • trunk/thrudex/src/CLuceneIndex.h

    r335 r347  
    9090    boost::shared_ptr<lucene::store::CLuceneRAMDirectory>  ram_directory; 
    9191    boost::shared_ptr<lucene::store::CLuceneRAMDirectory>  ram_prev_directory; 
     92    boost::shared_ptr<lucene::store::CLuceneRAMDirectory>  ram_readonly_prev_directory; 
    9293    boost::shared_ptr<lucene::store::CLuceneRAMDirectory>  ram_prev_prev_directory; 
    9394    boost::shared_ptr<lucene::store::CLuceneRAMDirectory>  ram_readonly_directory;