]> git.saurik.com Git - cydia.git/commitdiff
Numerical tweaks to the relevancy algorithm.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 9 Mar 2011 22:43:55 +0000 (14:43 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 9 Mar 2011 22:43:55 +0000 (14:43 -0800)
MobileCydia.mm

index 885f36b89525ccb89abea372d2c3df4c6b9cc6db..4ab0ea1b7638e8562c647253ec6b0c568559adf0 100644 (file)
@@ -2700,21 +2700,24 @@ struct PackageNameOrdering :
 
     [self parse];
 
-    string = [self id];
+    string = [self name];
     length = [string length];
 
     for (NSString *term in query) {
         range = [string rangeOfString:term options:MatchCompareOptions_];
         if (range.location != NSNotFound)
-            rank_ -= 10 * 100000 / length;
+            rank_ -= 6 * 1000000 / length;
     }
 
-    string = [self name];
+    if (rank_ == 0) {
+        string = [self id];
+        length = [string length];
 
-    for (NSString *term in query) {
-        range = [string rangeOfString:term options:MatchCompareOptions_];
-        if (range.location != NSNotFound)
-            rank_ -= 6 * 100000 / length;
+        for (NSString *term in query) {
+            range = [string rangeOfString:term options:MatchCompareOptions_];
+            if (range.location != NSNotFound)
+                rank_ -= 6 * 1000000 / length;
+        }
     }
 
     string = [self shortDescription];
@@ -2724,7 +2727,7 @@ struct PackageNameOrdering :
     for (NSString *term in query) {
         range = [string rangeOfString:term options:MatchCompareOptions_ range:NSMakeRange(0, stop)];
         if (range.location != NSNotFound)
-            rank_ -= 2 * 100000 / length;
+            rank_ -= 2 * 100000;
     }
 
     return rank_ != 0;