diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-09 14:43:55 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-09 14:43:55 -0800 |
commit | 718c267cc5f20ad720aff5958a12f4df4d605c71 (patch) | |
tree | f5ce8bde71397fcf97f218ad7d9834415cde3c47 /MobileCydia.mm | |
parent | 64b12ab3d8fb81134b220932f828e15b95808be6 (diff) |
Numerical tweaks to the relevancy algorithm.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 885f36b..4ab0ea1 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -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; |