2 * Copyright (c) 2022 Omar Polo <op@omarpolo.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
37 const char *longest_word;
38 const char *most_popular;
39 size_t most_popular_ndocs;
47 typedef int (*db_hit_cb)(struct db *, struct db_entry *, void *);
51 int db_create(FILE *, struct dictionary *, struct db_entry *, size_t);
52 int db_open(struct db *, int);
53 uint32_t *db_word_docs(struct db *, const char *, size_t *);
54 int db_stats(struct db *, struct db_stats *);
55 int db_listall(struct db *, db_hit_cb, void *);
56 int db_doc_by_id(struct db *, int, struct db_entry *);
57 void db_close(struct db *);