Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

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

Open
mlvzk opened this issue Jan 29, 2021 · 0 comments
Open

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

mlvzk opened this issue Jan 29, 2021 · 0 comments
Labels
database Reads/writes database enhancement New feature or request

Comments

@mlvzk
Copy link
Member

mlvzk commented Jan 29, 2021

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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
database Reads/writes database enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants