Changeset 285

Show
Ignore:
Timestamp:
02/19/08 04:18:18 (9 months ago)
Author:
jake
Message:

Throxy, unfinished, checkpoint

Location:
trunk
Files:
18 added
3 modified

Legend:

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

    r267 r285  
    2727    } 
    2828 
    29  
    3029    analyzer = boost::shared_ptr<lucene::analysis::Analyzer>(new lucene::analysis::standard::StandardAnalyzer()); 
    3130 
    3231    //grab the list of current indices 
    33     boost::filesystem::directory_iterator i(idx_root); 
    3432    boost::filesystem::directory_iterator end; 
    3533 
    36     if (i != end && is_directory (i->status ())) 
    37     { 
    38         this->addIndex( i->path().leaf() ); 
    39     } 
    40  
     34    for(boost::filesystem::directory_iterator i(idx_root); i != end; ++i){ 
     35 
     36        if(is_directory (i->status ())) 
     37        { 
     38            //skip hidden dirs (.) 
     39            if(i->path().leaf().substr(0,1) == ".") 
     40                continue; 
     41 
     42            this->addIndex( i->path().leaf() ); 
     43 
     44            LOG4CXX_INFO(logger, "Added "+i->path().leaf() ); 
     45        } 
     46    } 
    4147} 
    4248 
  • trunk/thrudoc/src/thrudoc_bench.cpp

    r216 r285  
    1212#endif 
    1313/* hack to work around thrift and log4cxx installing config.h's */ 
    14 #undef HAVE_CONFIG_H  
     14#undef HAVE_CONFIG_H 
    1515 
    1616#include <concurrency/ThreadManager.h> 
  • trunk/tutorial/rb/BookmarkExample.rb

    r203 r285  
    1919THRUDOC_BUCKET = "bookmarks"; 
    2020 
    21 THRUDEX_DOMAIN = "tutorial"; 
    2221THRUDEX_INDEX  = "bookmarks"; 
    2322 
     
    4746 
    4847          transport.open() 
     48 
     49          @thrudex.admin("create_index", THRUDEX_INDEX); 
    4950      end 
    5051 
     
    8283                add_bookmark(b) 
    8384          } 
    84  
    85  
    86           @thrudex.commitAll() 
    8785 
    8886          t1 = Time.new() 
     
    121119         #bookmark object to a Thrudex Document 
    122120         # 
    123          doc  = DocMsg.new() 
    124  
    125          doc.docid  = id 
    126          doc.domain = THRUDEX_DOMAIN 
     121         doc  = Document.new() 
     122 
     123         doc.key    = id 
    127124         doc.index  = THRUDEX_INDEX 
    128125         doc.fields = [] 
     
    130127         field = Field.new() 
    131128 
    132  
    133129         #title 
    134          field.name    = "title" 
     130         field.key     = "title" 
    135131         field.value   = b.title 
    136132         field.sortable= true 
     
    139135         #tags 
    140136         field = Field.new() 
    141          field.name    = "tags" 
     137         field.key     = "tags" 
    142138         field.value   = b.tags 
    143139         doc.fields << field 
    144140 
    145          @thrudex.add( doc ) 
     141         @thrudex.put( doc ) 
    146142     end 
    147143 
     
    158154 
    159155                response.elements.each { |r| 
    160                    rm = RemoveMsg.new() 
    161                    rm.domain = THRUDEX_DOMAIN 
     156                   rm = Element.new() 
    162157                   rm.index  = THRUDEX_INDEX 
    163                    rm.docid  = r.key 
     158                   rm.key    = r.key 
    164159 
    165160                   docs << rm 
     
    170165                @thrudoc.removeList(response.elements) 
    171166 
    172  
    173                 @thrudex.commitAll() 
    174  
    175  
    176167                seed = response.seed 
    177168 
    178169        end while response.elements.length == limit 
    179  
    180170 
    181171        t1 = Time.new 
     
    193183        t0 = Time.new() 
    194184 
    195         q  = QueryMsg.new(); 
    196  
    197         q.domain = THRUDEX_DOMAIN 
     185        q  = SearchQuery.new(); 
     186 
    198187        q.index  = THRUDEX_INDEX 
    199188        q.query  = terms 
     
    210199        end 
    211200 
    212         ids = @thrudex.query( q ) 
     201        ids = @thrudex.search( q ) 
    213202 
    214203        if ids == nil 
     
    218207        print "Found "+ids.total.to_s+" bookmarks\n" 
    219208 
    220         if ids.ids.length > 0 
    221  
    222            doc_list = @thrudoc.getList( create_doc_list(ids.ids) ) 
     209        if ids.elements.length > 0 
     210 
     211           doc_list = @thrudoc.getList( create_doc_list(ids.elements) ) 
    223212           bms      = [] 
    224213           doc_list.each{ |doc| 
     
    243232              doc        = Element.new() 
    244233              doc.bucket = THRUDOC_BUCKET 
    245               doc.key    = id 
     234              doc.key    = id.key 
    246235 
    247236              docs << doc