]> git.notmuchmail.org Git - sup/commitdiff
yet more fixes on user queries
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 27 Dec 2006 18:14:27 +0000 (18:14 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 27 Dec 2006 18:14:27 +0000 (18:14 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@103 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/index.rb
lib/sup/modes/thread-index-mode.rb

index 1513428516e4a5ca962855c8eb02a5bf45ed6a79..b2b9441094b99f776783892b95c7edebb86cd64b 100644 (file)
@@ -25,7 +25,12 @@ class Index
     @dir = dir
     @sources = {}
     @sources_dirty = false
-    @qparser ||= Ferret::QueryParser.new :default_field => :body, :analyzer => Ferret::Analysis::WhiteSpaceAnalyzer.new(true)
+
+    wsa = Ferret::Analysis::WhiteSpaceAnalyzer.new true
+    sa = Ferret::Analysis::StandardAnalyzer.new Ferret::Analysis::FULL_ENGLISH_STOP_WORDS, true
+    @analyzer = Ferret::Analysis::PerFieldAnalyzer.new wsa
+    @analyzer[:body] = sa
+    @qparser ||= Ferret::QueryParser.new :default_field => :body, :analyzer => @analyzer
 
     self.class.i_am_the_instance self
   end
@@ -54,14 +59,9 @@ class Index
   def usual_sources; @sources.values.find_all { |s| s.usual? }; end
 
   def load_index dir=File.join(@dir, "ferret")
-    wsa = Ferret::Analysis::WhiteSpaceAnalyzer.new false
-    sa = Ferret::Analysis::StandardAnalyzer.new
-    analyzer = Ferret::Analysis::PerFieldAnalyzer.new wsa
-    analyzer[:body] = sa
-
     if File.exists? dir
       Redwood::log "loading index"
-      @index = Ferret::Index::Index.new(:path => dir, :analyzer => analyzer)
+      @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer)
     else
       Redwood::log "creating index"
       field_infos = Ferret::Index::FieldInfos.new :store => :yes
@@ -77,7 +77,7 @@ class Index
       field_infos.add_field :refs
       field_infos.add_field :snippet, :index => :no, :term_vector => :no
       field_infos.create_index dir
-      @index = Ferret::Index::Index.new(:path => dir, :analyzer => analyzer)
+      @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer)
     end
   end
 
index 32c73122715ca8801383910667f84e9e5be22f8a..aa1b6de283dd91684b2f6158e58e9fa3429e6f67 100644 (file)
@@ -287,9 +287,7 @@ class ThreadIndexMode < LineCursorMode
     update
     BufferManager.clear @mbid
     @mbid = nil
-
     BufferManager.draw_screen
-
     @ts.size - orig_size
   end