commit 646c6a94e9ac50b8ad98daaf246afab1fdbda30f
parent 16e1052c468fb9c768dffd4e737560c5c2a4d5df
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Wed, 27 Dec 2006 18:14:27 +0000
yet more fixes on user queries
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@103 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -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
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -287,9 +287,7 @@ class ThreadIndexMode < LineCursorMode
update
BufferManager.clear @mbid
@mbid = nil
-
BufferManager.draw_screen
-
@ts.size - orig_size
end