Displaying 1 result from an estimated 1 matches for "suggestionable_fields".
2006 Oct 05
4
search results autocompletion
...ass)
    reader = Index::IndexReader.new(Object.const_get(klass.name.upcase + 
"_INDEX_DIR"))
    terms = []
    begin
    reader.field_names.each {|field_name|
    term_enum = reader.terms(field_name)
      begin
        term = term_enum.term()
        if !term.nil?
            if klass::SUGGESTIONABLE_FIELDS.include?(field_name)
              terms << term
            end
        end
      end while term_enum.next?
    }
    ensure
      reader.close
    end
    return terms
  end
  def to_doc
    doc = {}
    doc[:term] = self.term
    return doc
  end
end
It works very well except that the...