Re: [PATCH] kconfig: sort found symbols by relevance

From: Jean Delvare
Date: Mon May 06 2013 - 11:29:43 EST


Le Monday 06 May 2013 Ã 15:02 +0200, Yann E. MORIN a Ãcrit :
> From: "Yann E. MORIN" <yann.morin.1998@xxxxxxx>
>
> When searching for symbols, return the symbols sorted by relevance.
>
> Relevance is the ratio of the length of the matched string and the
> length of the symbol name. Symbols of equal relevance are sorted
> alphabetically.
>
> Reported-by: Jean Delvare <jdelvare@xxxxxxx>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@xxxxxxx>
> Cc: Jean Delvare <jdelvare@xxxxxxx>
> Cc: Michal Marek <mmarek@xxxxxxx>
> Cc: Roland Eggner <edvx1@xxxxxxxxxxxxxxxxxx>
> Cc: Wang YanQing <udknight@xxxxxxxxx>
> ---
> scripts/kconfig/symbol.c | 66 +++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 57 insertions(+), 9 deletions(-)

I did not look at the code, only tested it, and it does what I asked for
originally: exact match is listed first. So thank you :)

However I am not sure if your implementation is what we want. Your
definition of "relevance" is somewhat arbitrary and may not be
immediately to others. For example, my own definition of "relevance" was
that symbols which start with the subject string are more relevant than
the symbols which have the string in the middle. Others would possibly
have other definitions.

So in the end you have somewhat complex code for a sort order which may
surprise or confuse the user. It may put close to each other options
which are completely unrelated, and suboptions very far from their
parent.

I am wondering if it might not be better to go for a more simple
strategy: exact match on top and then sort alphabetically. Or even just
sort alphabetically - now that I know regexps are supported, it is easy
to get the exact match when I need it.

Just my two cents, maybe others have a diverging opinion.

Thanks for your work anyway,
--
Jean Delvare
Suse L3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/