From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.90.117.16 with SMTP id p16cs277796agc; Mon, 19 Oct 2009 22:37:34 -0700 (PDT) Received: by 10.224.78.219 with SMTP id m27mr3040142qak.181.1256017053277; Mon, 19 Oct 2009 22:37:33 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 40si7774073qyk.108.2009.10.19.22.37.33; Mon, 19 Oct 2009 22:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id EF5FC18582D2; Tue, 20 Oct 2009 01:37:32 -0400 (EDT) Received: from magnesium.club.cc.cmu.edu (MAGNESIUM.CLUB.CC.cmu.edu [128.237.157.15]) by rubyforge.org (Postfix) with ESMTP id 77CBE18582CE for ; Tue, 20 Oct 2009 01:34:38 -0400 (EDT) Received: (qmail 32502 invoked from network); 20 Oct 2009 05:34:38 -0000 Received: from pion.club.cc.cmu.edu (HELO localhost.localdomain) (128.237.157.88) by magnesium.club.cc.cmu.edu with SMTP; 20 Oct 2009 05:34:38 -0000 From: Rich Lane To: sup-talk@rubyforge.org Date: Mon, 19 Oct 2009 22:34:37 -0700 Message-Id: <1256016877-5238-1-git-send-email-rlane@club.cc.cmu.edu> X-Mailer: git-send-email 1.6.4.2 In-Reply-To: <20091012223449.GB31940@tilus.net> References: <20091012223449.GB31940@tilus.net> Subject: [sup-talk] [PATCH] xapian: replace DocumentMethods module with plain monkeypatching X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org --- 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 -- 1.6.4.2 _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk