Re: [PATCH v3] kconfig: sort found symbols by relevance
From: Wang YanQing
Date: Thu May 09 2013 - 11:27:50 EST
On Mon, May 06, 2013 at 11:15:31PM +0200, Yann E. MORIN wrote:
> From: "Yann E. MORIN" <yann.morin.1998@xxxxxxx>
>
> When searching for symbols, return the symbols sorted by relevance.
>
> Sorting is done as thus:
> - first, symbols with a prompt, [1]
> - then, smallest offset, [2]
> - then, shortest match, [3]
> - then, highest relative match, [4]
> - finally, alphabetical sort [5]
>
> So, searching (eg.) for 'P.*CI' :
>
> [1] Symbols of interest are probably those with a prompt, as they can be
> changed, while symbols with no prompt are only for info. Thus:
> PCIEASPM comes before PCI_ATS
Search the value of symbols with no prompt are useful too
> [2] Symbols that match earlier in the name are to be preferred over
> symbols which match later. Thus:
> PCI_MSI comes before WDTPCI
We can achieve this with ^PCI regular search
> [3] The shortest match is (IMHO) more interesting than a longer one.
> Thus:
> PCI comes before PCMCIA
We can achieve this with ^PCI regular search plus your previous heuristic
> [4] The relative match is the ratio of the length of the match against
> the length of the symbol. The more of a symbol name we match, the
> more instersting that symbol is. Thus:
> PCIEAER comes before PCIEASPM
This is what your first heuristic
> [5] As fallback, sort symbols alphabetically
This is in your first heuristic too.
> This heuristic tries hard to get interesting symbols first in the list.
I don't mean your this heuristic is bad, but
maybe provide mechanism to user will make guesser life easier.
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/