[kupfer] relevance: remove unnecessary check
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] relevance: remove unnecessary check
- Date: Fri, 11 Sep 2009 18:50:15 +0000 (UTC)
commit c09dc946a51d4fdc0b29807a97d62af3a2f8c984
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Fri Sep 11 20:04:13 2009 +0200
relevance: remove unnecessary check
kupfer/relevance.py | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/relevance.py b/kupfer/relevance.py
index 588e049..3381676 100644
--- a/kupfer/relevance.py
+++ b/kupfer/relevance.py
@@ -114,13 +114,11 @@ def score(s, query):
# Find the shortest possible substring that matches the query
# and get the ration of their lengths for a base score
first, last = _findBestMatch(ls, query)
- if last - first == 0:
+ if first == -1:
return .0
-
+
score = len(query) / (last - first)
- if score == 0:
- return .0
-
+
# Now we weight by string length so shorter strings are better
score *= .7 + len(query) / len(s) * .3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]