def search(query)
      # get ranks
      query_vector = make_query_vector(query)
      ranks = @documents.map do |document|
        document_vector = make_vector(document)
        cosine_rank(query_vector, document_vector)
      end
    
      # now annotate records and return them
      @records.each_with_index do |record, i|
        # TODO: do this in a sensible way...
        record.instance_eval %{def rank; #{ranks[i]}; end}
      end
    
      # exclude 0 rank (no match) and sort by rank
      @records.reject { |r| r.rank == 0 }.sort { |a,b| b.rank <=> a.rank }
    end
def search(query)
      # get ranks
      query_vector = make_query_vector(query)
      ranks = @documents.map do |document|
        document_vector = make_vector(document)
        cosine_rank(query_vector, document_vector)
      end
    
      # now annotate records and return them
      @records.each_with_index do |record, i|
        # TODO: do this in a sensible way...
        record.instance_eval %{def rank; #{ranks[i]}; end}
      end
    
      # exclude 0 rank (no match) and sort by rank
      @records.reject { |r| r.rank == 0 }.sort { |a,b| b.rank <=> a.rank }
    end
`documentizer` just takes a record and converts it to a string