commit 3b3c429f42ef55246e9237044bfd9c2763dadcea
parent 50993b2fc933e391f9caa450dc8df11f08bb5b69
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Mon, 2 Nov 2009 14:25:31 -0500
Merge branch 'xapian-bugfix' into next
Conflicts:
lib/sup/xapian_index.rb
Diffstat:
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
@@ -565,35 +565,32 @@ EOS
raise "Invalid term type #{type}"
end
end
+end
- module DocumentMethods
- def entry
- Marshal.load data
- end
-
- def entry=(x)
- self.data = Marshal.dump x
- end
+end
- def index_text text, prefix, weight=1
- term_generator = Xapian::TermGenerator.new
- term_generator.stemmer = Xapian::Stem.new(STEM_LANGUAGE)
- term_generator.document = self
- term_generator.index_text text, weight, prefix
- end
+class Xapian::Document
+ def entry
+ Marshal.load data
+ end
- def add_term term
- if term.length <= MAX_TERM_LENGTH
- super term
- else
- warn "dropping excessively long term #{term}"
- end
- end
+ def entry=(x)
+ self.data = Marshal.dump x
end
-end
-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
-class Xapian::Document
- include Redwood::XapianIndex::DocumentMethods
+ 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