Tweak RankedMatch::operator<

This commit is contained in:
Maxime Coste 2016-02-22 23:07:29 +00:00
parent ab20e2e5eb
commit 53821be7cc

View File

@ -87,10 +87,13 @@ RankedMatch::RankedMatch(StringView candidate, StringView query)
bool RankedMatch::operator<(const RankedMatch& other) const
{
if (m_only_word_boundary or other.m_only_word_boundary)
return m_only_word_boundary and other.m_only_word_boundary ?
m_word_boundary_match_count > other.m_word_boundary_match_count
: m_only_word_boundary;
if (m_only_word_boundary and other.m_only_word_boundary)
{
if (m_word_boundary_match_count != other.m_word_boundary_match_count)
return m_word_boundary_match_count > other.m_word_boundary_match_count;
}
else if (m_only_word_boundary or other.m_only_word_boundary)
return m_only_word_boundary;
if (m_prefix != other.m_prefix)
return m_prefix;