lib/sup/index.rb in sup-0.0.4 vs lib/sup/index.rb in sup-0.0.5

- old
+ new

@@ -134,19 +134,20 @@ ## temporarily disabling subject searching because it's a ## significant slowdown. ## ## TODO: make this configurable, i guess - if false + if true date_min = m.date - (SAME_SUBJECT_DATE_LIMIT * 12 * 3600) date_max = m.date + (SAME_SUBJECT_DATE_LIMIT * 12 * 3600) q = Ferret::Search::BooleanQuery.new true sq = Ferret::Search::PhraseQuery.new(:subject) wrap_subj(Message.normalize_subj(m.subj)).split(/\s+/).each do |t| sq.add_term t end q.add_query sq, :must + q.add_query Ferret::Search::TermQuery.new(:label, "spam"), :must_not q.add_query Ferret::Search::RangeQuery.new(:date, :>= => date_min.to_indexable_s, :<= => date_max.to_indexable_s), :must pending = @index.search(q).hits.map { |hit| @index[hit.doc][:message_id] } Redwood::log "found #{pending.size} results for subject query #{q}" else