NetBSD/usr.sbin/makemandb
abhinav 188f922ddf Add a custom tokenizer which does not stem certain keywords.
Which keywords should not be stemmed is specified in the nostem.txt file.
(Right now I have taken all the man page names, split them if they had
underscores, removed common English words and converted everything to
lowercase.)

The tokenizer itself is based on the Porter stemming tokenizer shipped with
Sqlite. The code in custom_apropos_tokenizer.c is copy of that code with
some modifications to prevent stemming keywords specified in nostem.txt.

Additionally, it now uses underscore `_' also as a token delimiter. Therefore,
now it's possible to do query for `lwp' and all `_lwp_*' man page names
will be matched. Or the query can be `unconst' and `__UNCONST' will be matched.
This was not possible earlier, because underscore was not a delimiter and therefore
the index would have __UNCONST as a key rather than UNCONST.

The tokenizer needs fts3_tokenizer.h file, which is not shipped with the
amalgamation build of Sqlite, therefore it needs to be added here (unless
we decide there is a better place for it).

To enforce using the new tokenizer, a schema version bump is needed

Since the tokenization is done both at the indexing time (via makemandb) and
also while query time (via apropos or whatis), it will be needed to bump
the schema version everytime nostem.txt is modified. Otherwise the
index will consist of old tokens and desired changes will not be seen with
apropos.

This should also fix the issue reported in PR bin/46255. Similar suggestion was
also made on tech-userlevel@ recently:
<http://mail-index.netbsd.org/tech-userlevel/2017/06/08/msg010620.html>

Thanks to christos@ for multiple rounds of reviews of the tokenizer code.
2017-06-18 16:24:10 +00:00
..
DBSCHEMA
Makefile Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
apropos-utils.3 Bring man pages in sync with reality. 2016-05-24 18:06:42 +00:00
apropos-utils.c Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
apropos-utils.h Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
apropos.1 Fix grammar/spelling at few places. 2016-06-17 18:48:07 +00:00
apropos.c Simplify handling of the section arguments in apropos(1). 2017-05-01 05:28:00 +00:00
close_db.3 Bring man pages in sync with reality. 2016-05-24 18:06:42 +00:00
custom_apropos_tokenizer.c Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
custom_apropos_tokenizer.h Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
fts3_tokenizer.h Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
init_db.3 Bring man pages in sync with reality. 2016-05-24 18:06:42 +00:00
makemandb.8 Improve wording, and add reference to mandoc(3) 2016-06-18 06:36:18 +00:00
makemandb.c Get rid of unnecessary variable. 2017-05-10 12:09:52 +00:00
nostem.txt Add a custom tokenizer which does not stem certain keywords. 2017-06-18 16:24:10 +00:00
run_query.3 Bring man pages in sync with reality. 2016-05-24 18:06:42 +00:00
stopwords.txt Add 'a' to the stopwords list. Ok from christos 2016-05-30 19:35:29 +00:00
whatis.1 Add man.conf(5) and man(1) in the SEE ALSO section. 2016-06-16 14:07:16 +00:00
whatis.c Make the name comparison case insensitive. 2017-05-23 15:27:54 +00:00