[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-talk] [PATCH] xapian: replace DocumentMethods module with plain monkeypatching
Disregard this one. (I thought master had already gotten my
update-message-state patch)
Excerpts from Rich Lane's message of Tue Oct 20 01:34:37 -0400 2009:
> ---
> lib/sup/xapian_index.rb | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
> index e1cfe65..c373c17 100644
> --- a/lib/sup/xapian_index.rb
> +++ b/lib/sup/xapian_index.rb
> @@ -560,7 +560,32 @@ EOS
> raise "Invalid term type #{type}"
> end
> end
> +end
>
> end
>
> +class Xapian::Document
> + def entry
> + Marshal.load data
> + end
> +
> + def entry=(x)
> + self.data = Marshal.dump x
> + end
> +
> + def index_text text, prefix, weight=1
> + term_generator = Xapian::TermGenerator.new
> + term_generator.stemmer =
> Xapian::Stem.new(Redwood::XapianIndex::STEM_LANGUAGE)
> + term_generator.document = self
> + term_generator.index_text text, weight, prefix
> + end
> +
> + alias old_add_term add_term
> + def add_term term
> + if term.length <= Redwood::XapianIndex::MAX_TERM_LENGTH
> + old_add_term term
> + else
> + warn "dropping excessively long term #{term}"
> + end
> + end
> end
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk