Bug 1093888 - [search] put exact matches first
Summary: [search] put exact matches first
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-05-03 02:48 UTC by Ben Boeckel
Modified: 2014-09-30 23:42 UTC (History)
7 users (show)

Fixed In Version: dnf-plugins-core-0.0.8-2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-05-31 23:57:30 UTC
Type: Bug

Attachments (Terms of Use)

Description Ben Boeckel 2014-05-03 02:48:14 UTC

dnf's search results are sorted by length (roughly). This is an approximately useless sorting method. Even sorting by package name would be more useful.

Comment 1 Ben Boeckel 2014-05-03 02:49:16 UTC
Ah, I see now. .i686 is put with .x86_64 lines, but sorted in order of length of the .x86_64 line which makes it look "roughly" sorted.

Comment 2 Ales Kozumplik 2014-05-05 05:45:08 UTC
Hello Ben, results are sorted by relevance. Please provide a specific test case where it is not so.

Comment 3 Ben Boeckel 2014-05-05 17:11:49 UTC
That may be so, but the sorting looks a lot like string length sorting:

# dnf search gnome socket
===================================================================== N/S Matched: socket =====================================================================
jnr-unixsocket.noarch : Unix sockets for Java
gwebsockets.noarch : GLib based websockets server
php-pear-Net-Socket.noarch : Network Socket Interface
python-socketpool.noarch : A simple Python socket pool
vanessa_socket.i686 : Simplify TCP/IP socket operations
vanessa_socket.x86_64 : Simplify TCP/IP socket operations
rudesocket-devel.i686 : Development files for rudesocket
rudesocket-devel.x86_64 : Development files for rudesocket
php-horde-Horde-Socket-Client.noarch : Horde Socket Client
jnr-unixsocket-javadoc.noarch : Javadocs for jnr-unixsocket
jetty-websocket-api.noarch : websocket-api module for Jetty
python-websocket-client.noarch : WebSocket client for python
jetty-websocket-parent.noarch : POM file for jetty-websocket
jboss-websocket-1.0-api.noarch : JSR-356: Java WebSocket 1.0 API
rudesocket.i686 : Library (C++ API) for creating client sockets
rudesocket.x86_64 : Library (C++ API) for creating client sockets
jetty-websocket-server.noarch : websocket-server module for Jetty
jetty-websocket-client.noarch : websocket-client module for Jetty
jetty-websocket-common.noarch : websocket-common module for Jetty
perl-IO-Socket-Timeout.noarch : IO::Socket with read/write timeout
jetty-websocket-servlet.noarch : websocket-servlet module for Jetty
SocketW-devel.i686 : Files for compiling software that uses SocketW
SocketW-devel.x86_64 : Files for compiling software that uses SocketW
SocketW.i686 : Streaming socket C++ library designed to be easy to use
SocketW.x86_64 : Streaming socket C++ library designed to be easy to use
perl-Socket-Netlink.x86_64 : Interface to Linux's PF_NETLINK socket family
jboss-websocket-1.0-api-javadoc.noarch : Javadocs for jboss-websocket-1.0-api
perl-Danga-Socket.noarch : Event loop and event-driven async socket base class
python-gevent-websocket.noarch : Websocket handler for the gevent pywsgi server
python-gevent-socketio.noarch : SocketIO server based on the Gevent pywsgi server
perl-IO-Socket-INET6.noarch : Perl Object interface for AF_INET|AF_INET6 domain sockets
socket_wrapper.i686 : A library passing all socket communications trough Unix sockets
socket_wrapper.x86_64 : A library passing all socket communications trough Unix sockets
nodejs-websocket-driver.noarch : WebSocket protocol handler with pluggable I/O for Node.js
perl-Socket6.x86_64 : IPv6 related part of the C socket.h defines and structure manipulators
nodejs-faye-websocket.noarch : A standards-compliant WebSocket server and client for Node.js
perl-Socket-Netlink-Route.noarch : Interface to Linux's NETLINK_ROUTE netlink socket protocol
perl-IO-Socket-IP.noarch : Drop-in replacement for IO::Socket::INET supporting both IPv4 and IPv6

the "gnome" section is similar in that it looks like a big cascade.

Comment 4 Ben Boeckel 2014-05-05 22:31:52 UTC
Here's another:

# dnf search make
====================================================================== N/S Matched: make ======================================================================
cmake-gui.x86_64 : Qt GUI for cmake
bmake.x86_64 : The NetBSD make(1) tool
cmake.x86_64 : Cross-platform make system
cmake-doc.x86_64 : Documentation for cmake
remake-doc.noarch : Documentation for remake
gnustep-make.x86_64 : GNUstep makefile package
pacemaker-libs.x86_64 : Core Pacemaker libraries
polymake-doc.x86_64 : Documentation for polymake
pacemaker-libs.i686 : Core Pacemaker libraries
pacemaker-doc.x86_64 : Documentation for Pacemaker
texlive-lmake-doc.noarch : Documentation for lmake
texlive-makebox.noarch : Defines a \makebox* command
texlive-makeindex-bin.x86_64 : Binaries for makeindex
texlive-makebox-doc.noarch : Documentation for makebox
polymake-devel.i686 : Development files for polymake
polymake-devel.x86_64 : Development files for polymake
texlive-makedtx-doc.noarch : Documentation for makedtx
makeself.noarch : Make self-extractable archives on Unix
texlive-imakeidx-doc.noarch : Documentation for imakeidx
texlive-makeplot-doc.noarch : Documentation for makeplot
texlive-makeglos-doc.noarch : Documentation for makeglos
gnustep-make-doc.noarch : Documentation for gnustep-make
texlive-makecmds-doc.noarch : Documentation for makecmds
texlive-makecirc-doc.noarch : Documentation for makecirc
texlive-makecell-doc.noarch : Documentation for makecell
perl-ExtUtils-MakeMaker.noarch : Create a module Makefile
drbd-pacemaker.x86_64 : Pacemaker resource agent for DRBD
eclipse-cmakeed.noarch : CMake Editor plug-in for Eclipse
perl-Makefile-Parser.noarch : Simple parser for Makefiles
perl-Makefile-DOM.noarch : Simple DOM parser for Makefiles
texlive-makeshape-doc.noarch : Documentation for makeshape
texlive-makeindex-doc.noarch : Documentation for makeindex
jpanoramamaker-javadoc.noarch : Javadocs for jpanoramamaker
pacemaker-libs-devel.x86_64 : Pacemaker development package
pacemaker-libs-devel.i686 : Pacemaker development package
WindowMaker-devel.i686 : Development files for WindowMaker
WindowMaker-devel.x86_64 : Development files for WindowMaker
texlive-makebarcode-doc.noarch : Documentation for makebarcode
perl-Sort-Maker.noarch : Simple way to make efficient sort subs
imake.x86_64 : imake source code configuration and build system
cmake-fedora.noarch : CMake helper modules for fedora developers
automake.noarch : A GNU tool for automatically creating Makefiles
WindowMaker-extra.noarch : Extra icons and themes for WindowMaker
pacemaker-cluster-libs.i686 : Cluster Libraries used by Pacemaker
pacemaker-cluster-libs.x86_64 : Cluster Libraries used by Pacemaker

Comment 5 Parag Nemade 2014-05-06 05:52:52 UTC
I too found this and my observations are provided in comment https://bugzilla.redhat.com/show_bug.cgi?id=1094301#c4

Comment 6 Ales Kozumplik 2014-05-06 12:11:23 UTC
I analyzed these cases against our relevance algorithm and you are getting intended results: generally, we look at what packages match in their name and summary and propagate to the top those that match most arguments as given by the user. In comment 3 case, there's no package that would match both the args against package's name but there are many that match one of the arguments agaisnt both summary and name. So they are at one of the top paragraphs. Those that match only name or only summary follow in next paragraphs.

The concern is whether the ordering within a paragraph of specific matching is not simply by string length. It looks like it and what the implementation does for matches of same weight is to sort them by distance, e.g. put those first where the matching attribute matches the argument by relatively larger substring. Given constant length of the argument this sometimes produces the effect you are perceiving (the length of nonmatching attribute, e.g. name in this case also plays role in the total line length). But in fact it does not matter: reiterating, within the given paragraph all matches are of equal weight.

Comment 4 proves this point: 'make' was searched and 'make' the package was returned first. How can DNF do better?

Closing this as NOTABUG. Note I am 100% open to major improvements in this area if reasonable ones are proposed as systematic problem descriptions or even properly written implementations.

Additionaly, I'd like to kindly ask you to avoid using emotional words like 'useless' or worse in bug descriptions. All of us are doing our best.

Comment 7 Ales Kozumplik 2014-05-06 12:20:24 UTC
Hm, I see what you are talking about in comment 4, 'make' itself actually ends up below 'cmake' etc. (because it only matches on name and not on both name and summary like e.g. cmake).

Comment 8 Ales Kozumplik 2014-05-06 15:52:30 UTC
Fixed upstream by 5091cfe.

Comment 9 Fedora Update System 2014-05-28 12:09:03 UTC
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been submitted as an update for Fedora 20.

Comment 10 Fedora Update System 2014-05-28 23:48:58 UTC
Package dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.0.8-2.fc20 libsolv-0.6.1-1.git6d968f1.fc20 hawkey-0.4.16-1.fc20 dnf-0.5.2-1.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2014-05-31 23:57:30 UTC
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.