60a4ecfb75c91dcfd9b8cda55641736d38869adb
[idzebra-moved-to-github.git] / include / idzebra / snippet.h
1 /* $Id: snippet.h,v 1.10 2007-08-21 13:27:04 adam Exp $
2    Copyright (C) 1995-2007
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 #ifndef IDZEBRA_SNIPPET_H
24 #define IDZEBRA_SNIPPET_H
25
26 #include <idzebra/util.h>
27
28 YAZ_BEGIN_CDECL
29
30 struct zebra_snippet_word {
31     zint seqno;
32     int ord;
33     char *term;
34     int match;
35     int mark;
36     int ws;
37     struct zebra_snippet_word *next;
38     struct zebra_snippet_word *prev;
39 };
40
41 typedef struct zebra_snippets zebra_snippets;
42 typedef struct zebra_snippet_word zebra_snippet_word;
43
44 YAZ_EXPORT
45 zebra_snippets *zebra_snippets_create(void);
46
47 YAZ_EXPORT
48 void zebra_snippets_destroy(zebra_snippets *l);
49
50 YAZ_EXPORT
51 void zebra_snippets_append(zebra_snippets *l,
52                            zint seqno, int ws, int ord, const char *term);
53
54 YAZ_EXPORT
55 void zebra_snippets_appendn(zebra_snippets *l,
56                             zint seqno, int ws, int ord,
57                             const char *term, size_t term_len);
58
59 YAZ_EXPORT
60 void zebra_snippets_append_match(zebra_snippets *l,
61                                  zint seqno, int ws, int ord,
62                                  const char *term, size_t term_len,
63                                  int match);
64
65 YAZ_EXPORT
66 zebra_snippet_word *zebra_snippets_list(zebra_snippets *l);
67
68 YAZ_EXPORT
69 const zebra_snippet_word *zebra_snippets_constlist(const zebra_snippets *l);
70
71 YAZ_EXPORT
72 void zebra_snippets_log(const zebra_snippets *l, int log_level, int all);
73
74 YAZ_EXPORT
75 zebra_snippets *zebra_snippets_window(const zebra_snippets *doc,
76                                       const zebra_snippets *hit,
77                                       int window_size);
78
79 YAZ_EXPORT
80 void zebra_snippets_ring(zebra_snippets *doc, const zebra_snippets *hit,
81                          int before, int after);
82
83
84 YAZ_EXPORT
85 const struct zebra_snippet_word *zebra_snippets_lookup(
86     const zebra_snippets *doc, const zebra_snippets *hit);
87
88 YAZ_END_CDECL
89
90 #endif
91 /*
92  * Local variables:
93  * c-basic-offset: 4
94  * indent-tabs-mode: nil
95  * End:
96  * vim: shiftwidth=4 tabstop=8 expandtab
97  */
98