Changeset 97564968f9aed076ddedd60a97b504b972e3f7fc

Show
Ignore:
Timestamp:
06/22/08 11:38:00 (7 months ago)
Author:
David Balmain <dbalmain@…>
Parents:
b82c99a2260ab756fe85d7b61da340581dc3b461
Children:
a249f609ee1784b37b8bce802dfa88406cc2c3fd
git-committer:
David Balmain <dbalmain@gmail.com> / 2008-06-22T11:38:00Z+1000
Message:

Fixed ruby bindings and added Index#term_vector

* Added Index#term_vector method
* In Rakefile: need to use ln_sf instead of ln or we can't rebuild
* Added ext/scanner_utf8.c to .gitignore
* temporary fix to #define FRT_REALLOC_N REALLOC_N

Location:
ruby
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ruby/.gitignore

    r0c11a5 r975649  
    9999ext/scanner.[ch] 
    100100ext/scanner_mb.c 
     101ext/scanner_utf8.c 
    101102ext/search.c 
    102103ext/search.h 
  • ruby/Rakefile

    r88af92 r975649  
    8484    # prepend lib files to avoid conflicts 
    8585    file dest_fn => fn do |t| 
    86       ln fn, dest_fn 
     86      ln_sf File.expand_path(fn), File.expand_path(dest_fn) 
    8787 
    8888      if fn =~ /stemmer/ 
  • ruby/ext/lang.h

    rb0a45e r975649  
    1414#define frt_ecalloc(n) xcalloc(n, 1) 
    1515#define frt_erealloc xrealloc 
     16/* FIXME: should eventually delete this */ 
     17#define FRT_REALLOC_N REALLOC_N 
    1618 
    1719 
  • ruby/lib/ferret/index.rb

    r482d0e r975649  
    480480    alias :[] :doc 
    481481 
     482    # Retrieves the term_vector for a document. The document can be referenced 
     483    # by either a string id to match the id field or an integer corresponding 
     484    # to Ferret's document number. 
     485    # 
     486    # See Ferret::Index::IndexReader#term_vector 
     487    def term_vector(id, field) 
     488      @dir.synchronize do 
     489        ensure_reader_open() 
     490        if id.kind_of?(String) or id.kind_of?(Symbol) 
     491          term_doc_enum = @reader.term_docs_for(@id_field, id.to_s) 
     492          if term_doc_enum.next? 
     493            id = @reader[term_doc_enum.doc] 
     494          else 
     495            return nil 
     496          end 
     497        end 
     498        return @reader.term_vector(id, field) 
     499      end 
     500    end 
     501 
    482502    # iterate through all documents in the index. This method preloads the 
    483503    # documents so you don't need to call #load on the document to load all the