NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/47701: apropos doesn't work



Hi,

On Thu, Mar 28, 2013 at 9:05 AM,  <root%garbled.net@localhost> wrote:
> The new apropos in 6, doesn't seem to give reasonable results.  While trying
> to find the usbdevs(8) command, I ran:
> apropos -C usb
>
> and got:
> alcyone# apropos -C usb
> usb (4) Universal Serial Bus driver
> usbhid (3) USB HID access routines
> cdce (4)   USB Communication Device Class Ethernet driver
> ulpt (4)   USB printer support
> uep (4) USB eGalax Touchpanel
> ukbd (4)   USB keyboard support
> cue (4) CATC USB-EL1201A USB Ethernet driver
> uts (4) USB generic touchscreens
> umodem (4) USB modem support
> ucom (4)   USB tty support
>
> If I want to find usbdevs, apparently I have to do -C8 ??

As others have mentioned, the new apropos displays only the top 10
results, which some times might not be enough to get the expected
results.
There is a -n option as well to specify exactly how many results you
want to see.

As far as usbdevs(8) not appearing in the top results is concerned,
its a hard problem to figure out what exactly the user is looking for
:)
But on a more serious note, apropos uses term frequency to compute the
rank of matching man pages in search results (apart from few other
factors).  In case of usbdevs(8) man page, its length is too short
(which should not be too big a contributing factor, since the
algorithm tries to normalize it). But more importantly, the keywords
usbdevs and usb are treated as two different keywords by apropos,
which means an occurrence of usbdevs in the man page does not
contribute towards a higher rank.

I will try to experiment, if the ranking algorithm can be tweaked in
some way to improve behaviour in such cases.

>
> Aside from that, I find the new format of man -k to be obnoxious.  Can we
> revert to the historical display, or maybe make it sensitive to an environment
> var, like OLDMAN=YES ? :)

Not possible to get the exact same behaviour as the old apropos, but
it is still possible to just perform search in the NAME section (like
the old apropos).  You can disable indexing of complete content of man
pages by using makemandb -lf, after which apropos automatically will
search in the NAME section. However, if there is a demand, I can add
an option to apropos itself to just search in the NAME section.

--
Abhinav


Home | Main Index | Thread Index | Old Index