mbox

[bug#36390,0/3] Improve 'guix search' relevance and display

Message ID 20190626084338.3153-1-ludo@gnu.org
Headers show

Message

Ludovic Courtès June 26, 2019, 8:43 a.m. UTC
Hello Guix!

This improves ‘guix search’ in two ways:

  1. The relevance score now excludes things that do not match *all*
     the regexps.  So ‘guix search go game’ returns 28 results instead
     of 1,245 and the first one is ‘gnugo’; ‘guix search ssh client’
     returns 14 results instead of 510; ‘guix search guile crypto’
     returns just ‘guile-gcrypt’ instead of 279 results.

  2. ‘guix search’ and ‘guix system search’ now write at most a full
     screen of results.  You can pipe through a pager to view all the
     results.

Thoughts?

Ludo’.

Ludovic Courtès (3):
  ui: 'relevance' considers regexps connected with a logical and.
  syscalls: Add 'terminal-rows'.
  ui: Add 'display-search-results' and use it.

 guix/build/syscalls.scm        | 37 +++++++++++------
 guix/scripts/package.scm       | 41 ++++++++-----------
 guix/scripts/system/search.scm | 44 +++++++++-----------
 guix/ui.scm                    | 75 ++++++++++++++++++++++++++++------
 tests/syscalls.scm             |  5 ++-
 tests/ui.scm                   | 27 +++++++++++-
 6 files changed, 155 insertions(+), 74 deletions(-)

Comments

Ricardo Wurmus June 26, 2019, 9:57 a.m. UTC | #1
Ludovic Courtès <ludo@gnu.org> writes:

> This improves ‘guix search’ in two ways:
>
>   1. The relevance score now excludes things that do not match *all*
>      the regexps.  So ‘guix search go game’ returns 28 results instead
>      of 1,245 and the first one is ‘gnugo’; ‘guix search ssh client’
>      returns 14 results instead of 510; ‘guix search guile crypto’
>      returns just ‘guile-gcrypt’ instead of 279 results.
>
>   2. ‘guix search’ and ‘guix system search’ now write at most a full
>      screen of results.  You can pipe through a pager to view all the
>      results.

Perfect, thank you for the patches!

(I wonder why you chose to use “(cut > <> 0)” instead of “positive?” for
checking if a value is greater than zero.)

--
Ricardo
Ludovic Courtès June 27, 2019, 9:19 a.m. UTC | #2
Hello!

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> This improves ‘guix search’ in two ways:
>>
>>   1. The relevance score now excludes things that do not match *all*
>>      the regexps.  So ‘guix search go game’ returns 28 results instead
>>      of 1,245 and the first one is ‘gnugo’; ‘guix search ssh client’
>>      returns 14 results instead of 510; ‘guix search guile crypto’
>>      returns just ‘guile-gcrypt’ instead of 279 results.
>>
>>   2. ‘guix search’ and ‘guix system search’ now write at most a full
>>      screen of results.  You can pipe through a pager to view all the
>>      results.
>
> Perfect, thank you for the patches!

It seems rather non-controversial.  :-)

Pushed:

  4311cf965c ui: Add 'display-search-results' and use it.
  4593f5a654 syscalls: Add 'terminal-rows'.
  8874faaaac ui: 'relevance' considers regexps connected with a logical and.

> (I wonder why you chose to use “(cut > <> 0)” instead of “positive?” for
> checking if a value is greater than zero.)

Actually no good reasons, I wanted to amend it and then forgot.

Thanks,
Ludo’.