Subject: [sup-talk] Bugfix for custom-search

From: [email-masked] (Edward Z. Yang)
Date: Thu, 01 Oct 2009 13:38:27 -0400

I think there's a slight bug in the custom-search implementation.
Patch is here:

>From cea17180933469570e9502ffa7bf67ccaa8ccfc7 Mon Sep 17 00:00:00 2001
From: Edward Z. Yang <edwardzyang at thewritingpot.com>
Date: Wed, 10 Jun 2009 01:42:50 -0400
Subject: [PATCH] Fix bug in which custom-search substitutions are not used.

Signed-off-by: Edward Z. Yang <ezyang at mit.edu>
---
 lib/sup/ferret_index.rb |    2 +-
 lib/sup/xapian_index.rb |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sup/ferret_index.rb b/lib/sup/ferret_index.rb
index d605e8d..34dff87 100644
--- a/lib/sup/ferret_index.rb
+++ b/lib/sup/ferret_index.rb
@@ -340,7 +340,7 @@ EOS
     query = {}
 
     subs = HookManager.run("custom-search", :subs => s) || s
-    subs = s.gsub(/\b(to|from):(\S+)\b/) do
+    subs = subs.gsub(/\b(to|from):(\S+)\b/) do
       field, name = $1, $2
       if(p = ContactManager.contact_for(name))
         [field, p.email]
diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
index ab25ea0..e1cfe65 100644
--- a/lib/sup/xapian_index.rb
+++ b/lib/sup/xapian_index.rb
@@ -193,7 +193,7 @@ EOS
     query = {}
 
     subs = HookManager.run("custom-search", :subs => s) || s
-    subs = s.gsub(/\b(to|from):(\S+)\b/) do
+    subs = subs.gsub(/\b(to|from):(\S+)\b/) do
       field, name = $1, $2
       if(p = ContactManager.contact_for(name))
         [field, p.email]
-- 
1.6.4.4