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

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

@mlvzk

Description

@mlvzk

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseReads/writes databaseenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions