[Yum-devel] [PATCH] Improve relevance ordering of search results.
James Antill
james at fedoraproject.org
Mon Oct 26 20:08:10 UTC 2009
On Mon, 2009-10-26 at 21:09 +0200, Ville Skyttä wrote:
diff --git a/cli.py b/cli.py
> index 5eed6c4..2d9c023 100644
> --- a/cli.py
> +++ b/cli.py
> @@ -803,7 +803,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
> if keys != okeys:
> if akeys:
> print ""
> - print self.fmtSection("Matched: " + ", ".join(sorted(keys)))
> + print self.fmtSection("Matched: " + ", ".join(keys))
> okeys = keys
> akeys.update(keys)
> self.matchcallback(po, matched_value, args)
> diff --git a/yum/__init__.py b/yum/__init__.py
[...]
> - tmpkeys = set()
> + tmpkeys = [] # use list to preserve given criteria order
> tmpvalues = []
> if count not in sorted_lists: sorted_lists[count] = []
> for s in real_crit_lower:
> @@ -1980,7 +1984,8 @@ class YumBase(depsolve.Depsolve):
> value = to_unicode(getattr(po, field))
> if value and value.lower().find(s) != -1:
> tmpvalues.append(value)
> - tmpkeys.add(rcl2c[s])
> + if rcl2c[s] not in tmpkeys:
> + tmpkeys.append(rcl2c[s])
In theory this is an API change, and I guess it's possible they'll be a
perf. issue (although mostly not). Might be easier to just change cli.py
to something like:
# Print them in the order they were passed...
used_keys = [arg for arg in args if arg in keys]
print self.fmtSection("Matched: " + ", ".join(used_keys))
...otherwise, ACK.
More information about the Yum-devel
mailing list