summaryrefslogtreecommitdiff
path: root/src/ranked_match.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-02-22 23:07:29 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-02-22 23:07:29 +0000
commit53821be7ccdc5d85cb31082640601a8224a9d8e4 (patch)
tree1d22e3075813d69f89b990cfea40c3d4c73c6fd9 /src/ranked_match.cc
parentab20e2e5eb9f53f9a79c6900d9d0b91852fd7871 (diff)
Tweak RankedMatch::operator<
Diffstat (limited to 'src/ranked_match.cc')
-rw-r--r--src/ranked_match.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ranked_match.cc b/src/ranked_match.cc
index a36ccdcc..6ef2b514 100644
--- a/src/ranked_match.cc
+++ b/src/ranked_match.cc
@@ -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;