Displaying 1 result from an estimated 1 matches for "all_terms".
2006 Oct 05
4
search results autocompletion
...a text input field with autocompletion . The suggestions come
from a ferret index which is created by getting all the terms belonging to
other indices. Here is the code:
class Suggestion
attr_accessor :term
def self.index(create)
[Person, Project, Orgunit].each{|kl|
terms = self.all_terms(kl)
terms.each{|term|
suggestion = Suggestion.new
suggestion.term = term
SUGGESTION_INDEX << suggestion.to_doc
}
}
SUGGESTION_INDEX.optimize
end
def self.all_terms(klass)
reader = Index::IndexReader.new(Object.const_get(klass.name.upcase +...