Groonga 3.0.9 Source Code Document
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
groonga
lib
snip.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 2 -*- */
2
/* Copyright(C) 2009-2012 Brazil
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License version 2.1 as published by the Free Software Foundation.
7
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Lesser General Public License for more details.
12
13
You should have received a copy of the GNU Lesser General Public
14
License along with this library; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
#ifndef GRN_SNIP_H
18
#define GRN_SNIP_H
19
20
#ifndef GROONGA_IN_H
21
#include "
groonga_in.h
"
22
#endif
/* GROONGA_IN_H */
23
24
#ifndef GRN_STR_H
25
#include "
str.h
"
26
#endif
/* GRN_STR_H */
27
28
#include "
db.h
"
29
30
#define ASIZE 256U
31
#define MAX_SNIP_TAG_COUNT 512U
32
#define MAX_SNIP_COND_COUNT 32U
33
#define MAX_SNIP_RESULT_COUNT 16U
34
35
#ifdef __cplusplus
36
extern
"C"
37
{
38
#endif
39
40
#define SNIPCOND_NONSTOP 0
41
#define SNIPCOND_STOP 1
42
#define SNIPCOND_ACROSS 2
43
44
#define GRN_QUERY_SCAN_ALLOCCONDS 0x0002
45
46
typedef
struct
_snip_cond
47
{
48
/* initial parameters */
49
const
char
*
opentag
;
50
const
char
*
closetag
;
51
size_t
opentag_len
;
52
size_t
closetag_len
;
53
grn_obj
*
keyword
;
54
55
/* Tuned BM pre */
56
size_t
bmBc
[
ASIZE
];
57
size_t
shift
;
58
59
/* Tuned BM temporal result */
60
size_t
found
;
61
size_t
last_found
;
62
size_t
last_offset
;
63
size_t
start_offset
;
64
size_t
end_offset
;
65
size_t
found_alpha_head
;
66
67
/* search result */
68
int
count
;
69
70
/* stop flag */
71
int_least8_t
stopflag
;
72
}
snip_cond
;
73
74
typedef
struct
75
{
76
size_t
start_offset
;
77
size_t
end_offset
;
78
snip_cond
*
cond
;
79
}
_snip_tag_result
;
80
81
typedef
struct
82
{
83
size_t
start_offset
;
84
size_t
end_offset
;
85
unsigned
int
first_tag_result_idx
;
86
unsigned
int
last_tag_result_idx
;
87
unsigned
int
tag_count
;
88
}
_snip_result
;
89
90
struct
_grn_snip
91
{
92
grn_db_obj
obj
;
93
grn_encoding
encoding
;
94
int
flags
;
95
size_t
width
;
96
unsigned
int
max_results
;
97
const
char
*
defaultopentag
;
98
const
char
*
defaultclosetag
;
99
size_t
defaultopentag_len
;
100
size_t
defaultclosetag_len
;
101
102
grn_snip_mapping
*
mapping
;
103
104
snip_cond
cond
[
MAX_SNIP_COND_COUNT
];
105
unsigned
int
cond_len
;
106
107
unsigned
int
tag_count
;
108
unsigned
int
snip_count
;
109
110
const
char
*
string
;
111
grn_obj
*
nstr
;
112
113
_snip_result
snip_result
[
MAX_SNIP_RESULT_COUNT
];
114
_snip_tag_result
tag_result
[
MAX_SNIP_TAG_COUNT
];
115
116
size_t
max_tagged_len
;
117
};
118
119
grn_rc
grn_snip_close_real
(
grn_ctx
*ctx,
grn_snip
*snip);
120
grn_rc
grn_snip_cond_init
(
grn_ctx
*ctx,
snip_cond
*sc,
const
char
*keyword,
unsigned
int
keyword_len,
121
grn_encoding
enc,
int
flags);
122
void
grn_snip_cond_reinit
(
snip_cond
*cond);
123
grn_rc
grn_snip_cond_close
(
grn_ctx
*ctx,
snip_cond
*cond);
124
void
grn_bm_tunedbm
(
grn_ctx
*ctx,
snip_cond
*cond,
grn_obj
*
string
,
int
flags);
125
126
#ifdef __cplusplus
127
}
128
#endif
129
130
#endif
/* GRN_SNIP_H */
Generated on Sun Nov 10 2013 09:49:04 for Groonga 3.0.9 Source Code Document by
1.8.1.2