A way to get all the words from an index?

Hi,

I am just wondering if there’s a way to get all the words from an
index. Basically, all the words that have been indexed (excluding the
stopwords if I’m using the stopwords analyzer, etc.)

The fields I’m putting in are not :stored in the index.

The idea is to implement a “did you mean?” mecanism, which is based
on the content of the index, not on a dictionary… Possible?

Thank you!

Philippe A.

On May 30, 2007, at 1:40 PM, Philippe A. wrote:

I am just wondering if there’s a way to get all the words from an
index. Basically, all the words that have been indexed (excluding the
stopwords if I’m using the stopwords analyzer, etc.)

perhaps something like this:

th_hash = {}
Resource.aaf_index.ferret_index.reader.terms(:body).each {|t, f|
term_hash[t] = f }
th_sorted = term_hash.sort {|a,b| a[1]<=>b[1]}.reverse

Cheers,
John

On May 30, 2007, at 3:49 PM, John B. wrote:

Resource.aaf_index.ferret_index.reader.terms(:body).each {|t, f|
term_hash[t] = f }

(Resource is the model being indexed)

John,

This is exactly what I’ve been looking for… I guess I didn’t know
about the reader!

Thank you,

Philippe