Re: [PATCH] kconfig: sort found symbols by relevance
From: Wang YanQing
Date: Mon May 06 2013 - 21:35:35 EST
On Mon, May 06, 2013 at 05:28:32PM +0200, Jean Delvare wrote:
> 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.
> 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.
But no matter what the definition of relevance in text search,
in the middle or start or end, the searcher always want the "results"
look like what they input literal.
I think Yann's definition make sense. It is just a pattern matching ratio question.
If you want in start, just use ^PCI(reguar search), then with the help of
this patch, will make people life easier.
This patch is not to replace the regular search, you can just use them together.
BTW, I haven't read the code right now, maybe I will read it tonight.
I test it, it works well, and I find it is useful to use it with regular search.
Thanks.
--
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/