[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 61/473: Tweak relevance of search results.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:53:51 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit dabb1fbc79a217518b032f9841c0682762a60471
Author: Graeme Gott <graeme at gottcode.org>
Date:   Wed Jul 3 11:33:50 2013 -0400

    Tweak relevance of search results.
---
 src/query.cpp |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/query.cpp b/src/query.cpp
index c9af7cc..c9f625e 100644
--- a/src/query.cpp
+++ b/src/query.cpp
@@ -115,12 +115,6 @@ unsigned int Query::match(const std::string& haystack) const
 		}
 	}
 
-	// Check if haystack contains query
-	if (pos != std::string::npos)
-	{
-		return 5;
-	}
-
 	// Check if haystack contains query as characters
 	bool characters_start_words = true;
 	bool start_word = true;
@@ -143,13 +137,19 @@ unsigned int Query::match(const std::string& haystack) const
 			start_word = false;
 		}
 	}
+	unsigned int result = UINT_MAX;
 	if (*query_string == 0)
 	{
-		return characters_start_words ? 6 : 7;
+		result = characters_start_words ? 5 : 7;
+	}
+
+	// Check if haystack contains query
+	if ((result > 5) && (pos != std::string::npos))
+	{
+		result = 6;
 	}
 
-	// Failed to find any matches
-	return UINT_MAX;
+	return result;
 }
 
 //-----------------------------------------------------------------------------

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list