:body => m.indexable_content,
:snippet => snippet,
:label => m.labels.uniq.join(" "),
- :from => m.from ? m.from.email : "",
- :to => (m.to + m.cc + m.bcc).map { |x| x.email }.join(" "),
+ :from => m.from ? m.from.indexable_content : "",
+ :to => (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" "),
:subject => wrap_subj(m.subj),
:refs => (m.refs + m.replytos).uniq.join(" "),
}
def indexable_content
load_from_source!
[
- from && "#{from.name} #{from.email}",
- to.map { |p| "#{p.name} #{p.email}" },
- cc.map { |p| "#{p.name} #{p.email}" },
- bcc.map { |p| "#{p.name} #{p.email}" },
+ from && from.indexable_content,
+ to.map { |p| p.indexable_content },
+ cc.map { |p| p.indexable_content },
+ bcc.map { |p| p.indexable_content },
chunks.select { |c| c.is_a? Chunk::Text }.map { |c| c.lines },
Message.normalize_subj(subj),
].flatten.compact.join " "
Person.new name, email
end
+ def indexable_content
+ [name, email, email.split(/@/).first].join(" ")
+ end
+
def eql? o; email.eql? o.email end
def hash; email.hash end
end