Pacman: search only in names and not descriptions?

In https://wiki.archlinux.org/title/pacman#Querying_package_databases, there’s this:

Sometimes, -s's builtin ERE (Extended Regular Expressions) can cause a lot of unwanted results, so it has to be limited to match the package name only; not the description nor any other field:

$ pacman -Ss '^vim-'

Running pacman -Ss '^vim-' returns a lot of hits but …

pacman -Ss '^tor-' gives 0 hits
whereas pacman -Ss '^tor' gives 5 hits including simply community/tor. Shouldn’t community/tor also have been found with pacman -Ss '^tor-'?

I’m even more confused by the output of pacman -Ss '^qt-' (lines numbered for ease of reference):

  ~ $ pacman -Ss '^qt-' | nl
     1  extra/kdsoap 2.0.0-1
     2      Qt-based client-side and server-side SOAP component
     3  extra/kwayland 5.89.0-1 (kf5)
     4      Qt-style Client and Server library wrapper for the Wayland libraries
     5  extra/libaccounts-qt 1.16-3
     6      Qt-based client library for accessing the online accounts database
     7  extra/qt-gstreamer 1.2.0-4
     8      Qt bindings for GStreamer
     9  community/ksnip 1.9.2-1 [installed]
    10      Qt-based screenshot tool that provides many annotation features
    11  community/python-qtconsole 5.2.1-2
    12      Qt-based console for Jupyter with support for rich media output
    13  community/qjournalctl 0.6.3-2
    14      Qt-based graphical user interface for the journalctl command
    15  community/qt5-gsettings 1.3.0-1 (liri)
    16      Qt-style wrapper for GSettings
    17  community/sigdigger 0.1.0-2
    18      Qt-based digital signal analyzer, using Suscan core and Sigutils DSP library
  ~ $

The names in lines 1, 3, 9, 17 (and 13 if one doesn’t allow fuzzy search) don’t have qt in them.

So I’m getting the impression that flanking a string with ^ and - doesn’t always work to yield results in which the string is in the name. Am I wrong?

No, because tor does not have a dash in it.

Both package names and descriptions are searched, and the search term is case-insensitive.

The search term passed as an argument to pacman is a Regular Expression, there is no fuzzy search.

From pacman manpages:

The Arch wiki article is clearly wrong. If you want to search only the package names, a simple way to do it is with grep:

pacman -Ssq | grep '^qt-'

This returns only

qt-gstreamer

To learn more about regular expressions, read:

man 7 regex
2 Likes

Gasp!

Anyway, in short, both names and descriptions are searched.

In the apt world, there’s apt search --names-only.