Mon Oct 3 13:36:35 2016 UTC ()
Mark the section and md5_hash columns as unindexed in the FTS table, as they are not used for search


(abhinav)
diff -r1.28 -r1.29 src/usr.sbin/makemandb/apropos-utils.c

cvs diff -r1.28 -r1.29 src/usr.sbin/makemandb/apropos-utils.c (expand / switch to unified diff)

--- src/usr.sbin/makemandb/apropos-utils.c 2016/07/06 18:03:27 1.28
+++ src/usr.sbin/makemandb/apropos-utils.c 2016/10/03 13:36:35 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: apropos-utils.c,v 1.28 2016/07/06 18:03:27 abhinav Exp $ */ 1/* $NetBSD: apropos-utils.c,v 1.29 2016/10/03 13:36:35 abhinav Exp $ */
2/*- 2/*-
3 * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> 3 * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code was developed as part of Google's Summer of Code 2011 program. 6 * This code was developed as part of Google's Summer of Code 2011 program.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__RCSID("$NetBSD: apropos-utils.c,v 1.28 2016/07/06 18:03:27 abhinav Exp $"); 34__RCSID("$NetBSD: apropos-utils.c,v 1.29 2016/10/03 13:36:35 abhinav Exp $");
35 35
36#include <sys/queue.h> 36#include <sys/queue.h>
37#include <sys/stat.h> 37#include <sys/stat.h>
38 38
39#include <assert.h> 39#include <assert.h>
40#include <ctype.h> 40#include <ctype.h>
41#include <err.h> 41#include <err.h>
42#include <math.h> 42#include <math.h>
43#include <stdio.h> 43#include <stdio.h>
44#include <stdlib.h> 44#include <stdlib.h>
45#include <string.h> 45#include <string.h>
46#include <util.h> 46#include <util.h>
47#include <zlib.h> 47#include <zlib.h>
@@ -165,27 +165,28 @@ create_db(sqlite3 *db) @@ -165,27 +165,28 @@ create_db(sqlite3 *db)
165 165
166 schemasql = sqlite3_mprintf("PRAGMA user_version = %d", 166 schemasql = sqlite3_mprintf("PRAGMA user_version = %d",
167 APROPOS_SCHEMA_VERSION); 167 APROPOS_SCHEMA_VERSION);
168 sqlite3_exec(db, schemasql, NULL, NULL, &errmsg); 168 sqlite3_exec(db, schemasql, NULL, NULL, &errmsg);
169 if (errmsg != NULL) 169 if (errmsg != NULL)
170 goto out; 170 goto out;
171 sqlite3_free(schemasql); 171 sqlite3_free(schemasql);
172 172
173 sqlstr = 173 sqlstr =
174 //mandb 174 //mandb
175 "CREATE VIRTUAL TABLE mandb USING fts4(section, name, " 175 "CREATE VIRTUAL TABLE mandb USING fts4(section, name, "
176 "name_desc, desc, lib, return_vals, env, files, " 176 "name_desc, desc, lib, return_vals, env, files, "
177 "exit_status, diagnostics, errors, md5_hash UNIQUE, machine, " 177 "exit_status, diagnostics, errors, md5_hash UNIQUE, machine, "
178 "compress=zip, uncompress=unzip, tokenize=porter); " 178 "compress=zip, uncompress=unzip, tokenize=porter, "
 179 "notindexed=section, notindexed=md5_hash); "
179 //mandb_meta 180 //mandb_meta
180 "CREATE TABLE IF NOT EXISTS mandb_meta(device, inode, mtime, " 181 "CREATE TABLE IF NOT EXISTS mandb_meta(device, inode, mtime, "
181 "file UNIQUE, md5_hash UNIQUE, id INTEGER PRIMARY KEY); " 182 "file UNIQUE, md5_hash UNIQUE, id INTEGER PRIMARY KEY); "
182 //mandb_links 183 //mandb_links
183 "CREATE TABLE IF NOT EXISTS mandb_links(link, target, section, " 184 "CREATE TABLE IF NOT EXISTS mandb_links(link, target, section, "
184 "machine, md5_hash); "; 185 "machine, md5_hash); ";
185 186
186 sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg); 187 sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg);
187 if (errmsg != NULL) 188 if (errmsg != NULL)
188 goto out; 189 goto out;
189 190
190 sqlstr = 191 sqlstr =
191 "CREATE INDEX IF NOT EXISTS index_mandb_links ON mandb_links " 192 "CREATE INDEX IF NOT EXISTS index_mandb_links ON mandb_links "