Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add synonyms to !top [Distro OR Editor OR ...] #11

Closed
eepykate opened this issue Mar 2, 2021 · 1 comment · Fixed by #59
Closed

add synonyms to !top [Distro OR Editor OR ...] #11

eepykate opened this issue Mar 2, 2021 · 1 comment · Fixed by #59
Labels
database Reads/writes database enhancement New feature or request

Comments

@eepykate
Copy link
Contributor

eepykate commented Mar 2, 2021

by mlvzk: unixporn/trup#150

Like:

nvim => neovim
arch => Arch Linux

So that results in !top Editor don't have duplicate entries (1. nvim, 4. neovim should be joined into one)
image

Concept query:

WITH x AS (
    SELECT
        info ->> 'Editor' AS value,
        REPLACE(LOWER(info ->> 'Editor'), 'neovim', 'nvim') AS normalized
    FROM
        sysinfo
    WHERE
        info ->> 'Editor' != ''
),
y AS (
    SELECT DISTINCT ON (normalized)
        value,
        count(*) OVER (PARTITION BY normalized)
    FROM x ORDER BY normalized,
    count DESC
)
SELECT
    *
FROM
    y
ORDER BY
    count DESC
LIMIT 5
 value  | count
--------+-------
 Neovim |    96
 vim    |    55
 nano   |    24
 Emacs  |    10
 micro  |     8
(5 rows)
@eepykate eepykate added enhancement New feature or request database Reads/writes database labels Mar 2, 2021
@legendofmiracles
Copy link
Contributor

legendofmiracles commented Mar 16, 2021

or distro, Distribution and distribution instead of Distro when querying.

This was referenced Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Reads/writes database enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants