1 /* This file is part of the Zebra server.
2 Copyright (C) Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef IDZEBRA_SNIPPET_H
21 #define IDZEBRA_SNIPPET_H
23 #include <idzebra/util.h>
27 struct zebra_snippet_word {
28 zint seqno; /**< sequence number */
29 int ord; /**< ordinal, i.e. database,field,type */
30 char *term; /**< term itself */
31 int match; /**< both part and real match */
32 int mark; /**< part of snippet */
33 int ws; /**< white space flag (not indexed material) */
34 struct zebra_snippet_word *next;
35 struct zebra_snippet_word *prev;
38 typedef struct zebra_snippets zebra_snippets;
39 typedef struct zebra_snippet_word zebra_snippet_word;
42 zebra_snippets *zebra_snippets_create(void);
45 void zebra_snippets_destroy(zebra_snippets *l);
48 void zebra_snippets_append(zebra_snippets *l,
49 zint seqno, int ws, int ord, const char *term);
52 void zebra_snippets_appendn(zebra_snippets *l,
53 zint seqno, int ws, int ord,
54 const char *term, size_t term_len);
57 void zebra_snippets_append_match(zebra_snippets *l,
58 zint seqno, int ws, int ord,
59 const char *term, size_t term_len,
63 zebra_snippet_word *zebra_snippets_list(zebra_snippets *l);
66 const zebra_snippet_word *zebra_snippets_constlist(const zebra_snippets *l);
69 void zebra_snippets_log(const zebra_snippets *l, int log_level, int all);
72 zebra_snippets *zebra_snippets_window(const zebra_snippets *doc,
73 const zebra_snippets *hit,
77 void zebra_snippets_ring(zebra_snippets *doc, const zebra_snippets *hit,
78 int before, int after);
82 const struct zebra_snippet_word *zebra_snippets_lookup(
83 const zebra_snippets *doc, const zebra_snippets *hit);
91 * c-file-style: "Stroustrup"
92 * indent-tabs-mode: nil
94 * vim: shiftwidth=4 tabstop=8 expandtab