Commit Graph

10 Commits

Author SHA1 Message Date
rin a737f1efc9 makemandb: trailing whitespace 2023-08-03 07:49:23 +00:00
leot 83d9007765 Reintroduce case insensitive comparison of name accidentally lost in last
revision.

Discussed with <abhinav> via PR misc/54213, thanks!
2019-05-18 10:28:57 +00:00
abhinav 933b5da267 PR misc/54213: Fix performance of whatis(1) when no matches are found
In revision 1.6 of whatis.c the query was modified to return matches for names found
in MLINKS of the man pages as well. However it was slow. The reason probably being that it
required a join. But more importantly the where condition on an FTS virtual table column
is very slow. To avoid the join and the expensive where condition on the virtual table,
add the name_desc column to the mandb_links table as well. This improves the performance
of whatis(1) to the original level at the expense of slight data duplication.

Bump the schema to force database rebuild to take account for the new column addition
2019-05-18 07:56:43 +00:00
abhinav 2f6fb75f1b Make the name comparison case insensitive.
(The old whatis(1) also used to do case insensitive string comparisons).
2017-05-23 15:27:54 +00:00
abhinav b2c6ef38f4 Teach whatis(1) to handle MLINKS
Similar to apropos(1), whatis did not utilise the mandb_links table till now.
Therefore, if it was asked about one of the links to a man page, it would
error out. This change teaches whatis(1) to look up both the FTS table
as well as the links table, thus ensuring that it is able to answer queries
about MLINKS as well.

Comparision between outputs before this change and after this change:

#Before change
$ whatis realloc
realloc: not found

#after change
$ ./whatis realloc
realloc(3) - general memory allocation operations
realloc(3) - general purpose memory allocation functions
realloc(9) - general-purpose kernel memory allocator
2017-04-23 16:56:49 +00:00
abhinav e92872065a Add options to whatis and apropos to accept custom man.conf.
makemandb(8), man(1) already use -C as an option to take man.conf path,
	so use the same option for whatis(1) and apropos(1) for consitency.
	apropos was using -C/-c to disable/enable context of the search
	matches, change that to -M/-m respectively.
2016-05-22 19:26:04 +00:00
wiz b1203a9851 Make mandb path configurable. makemandb (and related tools) use
the path from the _mandb variable from man.conf now.

Set _mandb in man.conf to same value as was used before.

From Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>.
2012-10-06 15:33:59 +00:00
joerg 50a2d17c77 SQLite doesn't use the FTS index for equal ops, so force it to do a FTS
search first. Drops run time by a factor of 6 for "whatis man".
Found by Abhinav Upadhyay.
2012-02-20 18:27:30 +00:00
joerg 329b37d502 Fix C&P error with $NetBSD$ 2012-02-07 19:17:16 +00:00
joerg 410d0f4380 Import the new apropos/whatis.
This code has been developed by Abhinav Upadhyay as part of Google's Summer
of Code 2011. It uses libmandoc to parse man pages and builds a Full
Text Index in a SQLite database. The combination of indexing the full
manual page, filtering out stop words and ranking individual matches
based on the section gives a much improved user experience.

The old makewhatis and friends are kept under MKMAKEMANDB=no for now.
2012-02-07 19:13:24 +00:00