IDZEBRA  2.1.2
rpnscan.c
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
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
7 version.
8 
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
12 for more details.
13 
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
17 
18 */
19 
20 #if HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 #include <stdio.h>
24 #include <assert.h>
25 #ifdef WIN32
26 #include <io.h>
27 #endif
28 #if HAVE_UNISTD_H
29 #include <unistd.h>
30 #endif
31 #include <ctype.h>
32 
33 #include <yaz/diagbib1.h>
34 #include "index.h"
35 #include <zebra_xpath.h>
36 #include <yaz/wrbuf.h>
37 #include <attrfind.h>
38 #include <charmap.h>
39 #include <rset.h>
40 #include <yaz/oid_db.h>
41 
42 #define RPN_MAX_ORDS 32
43 
44 /* convert APT SCAN term to internal cmap */
45 static ZEBRA_RES trans_scan_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
46  char *termz, zebra_map_t zm)
47 {
48  char term_utf8[IT_MAX_WORD];
49 
50  if (zapt_term_to_utf8(zh, zapt, term_utf8) == ZEBRA_FAIL)
51  return ZEBRA_FAIL; /* error */
52  else if (zebra_maps_is_icu(zm))
53  {
54  const char *res_buf;
55  size_t res_len;
56  zebra_map_tokenize_start(zm, term_utf8, strlen(term_utf8));
57 
58  if (zebra_map_tokenize_next(zm, &res_buf, &res_len, 0, 0))
59  {
60  memcpy(termz, res_buf, res_len);
61  termz[res_len] = '\0';
62  }
63  else
64  termz[0] = '\0';
65  }
66  else
67  {
68  const char **map;
69  const char *cp = (const char *) term_utf8;
70  const char *cp_end = cp + strlen(cp);
71  const char *src;
72  int i = 0;
73  const char *space_map = NULL;
74  int len;
75 
76  while ((len = (cp_end - cp)) > 0)
77  {
78  map = zebra_maps_input(zm, &cp, len, 0);
79  if (**map == *CHR_SPACE)
80  space_map = *map;
81  else
82  {
83  if (i && space_map)
84  for (src = space_map; *src; src++)
85  termz[i++] = *src;
86  space_map = NULL;
87  for (src = *map; *src; src++)
88  termz[i++] = *src;
89  }
90  }
91  termz[i] = '\0';
92  }
93  return ZEBRA_OK;
94 }
95 
97  RSET rset, zebra_snippets *snippets,
98  zint *sysno)
99 {
100  struct it_key key;
101  RSFD rfd;
102  TERMID termid;
103  size_t sysno_mem_index = 0;
104 
105  if (zh->m_staticrank)
106  sysno_mem_index = 1;
107 
108  yaz_log(YLOG_DEBUG, "get_first_snippet_from_rset");
109 
110  rfd = rset_open(rset, RSETF_READ);
111  *sysno = 0;
112  while (rset_read(rfd, &key, &termid))
113  {
114  if (key.mem[sysno_mem_index] != *sysno)
115  {
116  if (*sysno)
117  break;
118  *sysno = key.mem[sysno_mem_index];
119  }
120  if (termid)
121  {
122  struct ord_list *ol;
123  for (ol = termid->ol; ol; ol = ol->next)
124  {
125  zebra_snippets_append(snippets, key.mem[key.len-1], 0,
126  ol->ord, termid->name);
127  }
128  }
129  }
130  rset_close(rfd);
131 }
132 
134  WRBUF term;
135  char prefix[20];
138  int ord;
139 };
140 
141 static int scan_handle2(char *name, const char *info, int pos, void *client)
142 {
143  int len_prefix;
144  struct scan2_info_entry *scan_info = (struct scan2_info_entry *) client;
145 
146  if (scan_info->pos_to_save != pos)
147  return 0;
148 
149  len_prefix = strlen(scan_info->prefix);
150  if (memcmp(name, scan_info->prefix, len_prefix))
151  return 1;
152  wrbuf_rewind(scan_info->term);
153  wrbuf_puts(scan_info->term, name+len_prefix);
154 
155  assert(*info == sizeof(ISAM_P));
156  memcpy(&scan_info->isam_p, info+1, sizeof(ISAM_P));
157  return 0;
158 }
159 
160 
161 static int scan_save_set(ZebraHandle zh, ODR stream, NMEM nmem,
162  struct rset_key_control *kc,
163  Z_AttributesPlusTerm *zapt,
164  RSET limit_set,
165  const char *term,
166  const char *index_type,
167  struct scan2_info_entry *ar, int ord_no,
168  ZebraScanEntry *glist, int pos)
169 {
170  int i;
171  RSET rset = 0;
172  zint approx_limit = zh->approx_limit;
173  AttrType global_hits_limit_attr;
174  int l;
175  attr_init_APT(&global_hits_limit_attr, zapt, 12);
176 
177  l = attr_find(&global_hits_limit_attr, NULL);
178  if (l != -1)
179  approx_limit = l;
180 
181  for (i = 0; i < ord_no; i++)
182  {
183  if (ar[i].isam_p && strcmp(wrbuf_cstr(ar[i].term), term) == 0)
184  {
185  if (strcmp(term, FIRST_IN_FIELD_STR))
186  {
187  struct ord_list *ol = ord_list_create(nmem);
188  RSET rset_t;
189 
190  ol = ord_list_append(nmem, ol, ar[i].ord);
191 
192  assert(ol);
193  rset_t = rset_trunc(
194  zh, &ar[i].isam_p, 1,
195  wrbuf_buf(ar[i].term), wrbuf_len(ar[i].term),
196  NULL, 1, zapt->term->which, nmem,
197  kc, kc->scope, ol, index_type,
198  0 /* hits_limit_value */,
199  0 /* term_ref_id_str */);
200  if (!rset)
201  rset = rset_t;
202  else
203  {
204  RSET rsets[2];
205 
206  rsets[0] = rset;
207  rsets[1] = rset_t;
208  rset = rset_create_or(nmem, kc, kc->scope, 0 /* termid */,
209  2, rsets);
210  }
211  }
212  ar[i].isam_p = 0;
213  }
214  }
215  if (rset)
216  {
217  RSET rset_snippet = rset; /* use only this for showing scan term */
218  zint count;
219  /* merge with limit_set if given */
220  if (limit_set)
221  {
222  RSET rsets[2];
223  rsets[0] = rset;
224  rsets[1] = rset_dup(limit_set);
225 
226  rset = rset_create_and(nmem, kc, kc->scope, 2, rsets);
227  }
228  /* count it */
229  zebra_count_set(zh, rset, &count, approx_limit);
230 
231  if (pos != -1)
232  {
233  zint sysno;
234  zebra_snippets *hit_snippets = zebra_snippets_create();
235 
236  glist[pos].term = 0;
237  glist[pos].display_term = 0;
238 
239  get_first_snippet_from_rset(zh, rset_snippet, hit_snippets, &sysno);
240  if (sysno)
241  {
242  zebra_snippets *rec_snippets = zebra_snippets_create();
243  int code = zebra_get_rec_snippets(zh, sysno, rec_snippets);
244  if (code == 0)
245  {
246  const struct zebra_snippet_word *w =
247  zebra_snippets_lookup(rec_snippets, hit_snippets);
248  if (w)
249  {
250  glist[pos].display_term = odr_strdup(stream, w->term);
251  }
252  else
253  {
254  yaz_log(YLOG_WARN, "zebra_snippets_lookup failed for pos=%d", pos);
255  }
256  }
257  zebra_snippets_destroy(rec_snippets);
258  }
259  if (zebra_term_untrans_iconv(zh, stream->mem, index_type,
260  &glist[pos].term, term))
261  {
262  /* failed.. use display_term instead (which could be 0) */
263  glist[pos].term = glist[pos].display_term;
264  }
265 
266  if (!glist[pos].term)
267  {
268  yaz_log(YLOG_WARN, "Could not generate scan term for pos=%d",
269  pos);
270  glist[pos].term = "None";
271  }
272  glist[pos].occurrences = count;
273  zebra_snippets_destroy(hit_snippets);
274  }
275  rset_delete(rset);
276  if (count > 0)
277  return 1;
278  else
279  return 0;
280  }
281  return 0;
282 }
283 
284 static ZEBRA_RES rpn_scan_norm(ZebraHandle zh, ODR stream, NMEM nmem,
285  struct rset_key_control *kc,
286  Z_AttributesPlusTerm *zapt,
287  int *position, int *num_entries,
288  ZebraScanEntry **list,
289  int *is_partial, RSET limit_set,
290  const char *index_type,
291  int ord_no, int *ords)
292 {
293  struct scan2_info_entry *ar = nmem_malloc(nmem, sizeof(*ar) * ord_no);
294  struct rpn_char_map_info rcmi;
295  zebra_map_t zm = zebra_map_get_or_add(zh->reg->zebra_maps, index_type);
296  int i, dif;
297  int after_pos;
298  int pos = 0;
299 
300  ZebraScanEntry *glist = (ZebraScanEntry *)
301  odr_malloc(stream, *num_entries * sizeof(*glist));
302 
303  *is_partial = 0;
304  rpn_char_map_prepare(zh->reg, zm, &rcmi);
305 
306  for (i = 0; i < ord_no; i++)
307  ar[i].term = wrbuf_alloc();
308 
309  for (i = 0; i < ord_no; i++)
310  {
311  char termz[IT_MAX_WORD+20];
312  int prefix_len = 0;
313 
314  prefix_len = key_SU_encode(ords[i], termz);
315  termz[prefix_len] = 0;
316  strcpy(ar[i].prefix, termz);
317 
318  if (trans_scan_term(zh, zapt, termz+prefix_len, zm) ==
319  ZEBRA_FAIL)
320  {
321  for (i = 0; i < ord_no; i++)
322  wrbuf_destroy(ar[i].term);
323  return ZEBRA_FAIL;
324  }
325  wrbuf_rewind(ar[i].term);
326  wrbuf_puts(ar[i].term, termz + prefix_len);
327  ar[i].isam_p = 0;
328  ar[i].ord = ords[i];
329  }
331  /* the glist index starts at zero (unlike scan positions */
332  for (pos = *position-2; pos >= 0; )
333  {
334  const char *hi = 0;
335 
336  /* scan on all maximum terms */
337  for (i = 0; i < ord_no; i++)
338  {
339  if (ar[i].isam_p == 0)
340  {
341  char termz[IT_MAX_WORD+20];
342  int before = 1;
343  int after = 0;
344 
345  ar[i].pos_to_save = -1;
346 
347  strcpy(termz, ar[i].prefix);
348  strcat(termz, wrbuf_cstr(ar[i].term));
349  dict_scan(zh->reg->dict, termz, &before, &after,
350  ar+i, scan_handle2);
351  }
352  }
353  /* get maximum after scan */
354  for (i = 0; i < ord_no; i++)
355  {
356  if (ar[i].isam_p
357  && (hi == 0 || strcmp(wrbuf_cstr(ar[i].term), hi) > 0))
358  hi = wrbuf_cstr(ar[i].term);
359  }
360  if (!hi)
361  break;
362  if (scan_save_set(zh, stream, nmem, kc, zapt, limit_set, hi,
363  index_type, ar, ord_no, glist,
364  (pos >= 0 && pos < *num_entries) ? pos : -1))
365  --pos;
366  }
367  /* see if we got all terms before.. */
368  dif = 1 + pos;
369  if (dif > 0)
370  {
371  /* did not get all terms; adjust the real position and reduce
372  number of entries */
373  if (dif < *num_entries)
374  {
375  glist = glist + dif;
376  *num_entries -= dif;
377  }
378  else
379  *num_entries = 0;
380  *position -= dif;
381  *is_partial = 1;
382  }
383  for (i = 0; i < ord_no; i++)
384  {
385  char termz[IT_MAX_WORD+20];
386  int prefix_len = 0;
387 
388  prefix_len = key_SU_encode(ords[i], termz);
389  termz[prefix_len] = 0;
390  strcpy(ar[i].prefix, termz);
391 
392  if (trans_scan_term(zh, zapt, termz+prefix_len, zm) ==
393  ZEBRA_FAIL)
394  return ZEBRA_FAIL;
395  wrbuf_rewind(ar[i].term);
396  wrbuf_puts(ar[i].term, termz + prefix_len);
397  ar[i].isam_p = 0;
398  ar[i].ord = ords[i];
399  }
400 
401  after_pos = 1; /* immediate term first.. */
402  for (pos = *position-1; pos < *num_entries; )
403  {
404  const char *lo = 0;
405 
406  /* scan on all minimum terms */
407  for (i = 0; i < ord_no; i++)
408  {
409  if (ar[i].isam_p == 0)
410  {
411  char termz[IT_MAX_WORD+20];
412  int before = 0;
413  int after = after_pos;
414 
415  ar[i].pos_to_save = 1;
416 
417  strcpy(termz, ar[i].prefix);
418  strcat(termz, wrbuf_cstr(ar[i].term));
419  dict_scan(zh->reg->dict, termz, &before, &after,
420  ar+i, scan_handle2);
421  }
422  }
423  after_pos = 2; /* next round we grab following term */
424 
425  /* get minimum after scan */
426  for (i = 0; i < ord_no; i++)
427  {
428  if (ar[i].isam_p
429  && (lo == 0 || strcmp(wrbuf_cstr(ar[i].term), lo) < 0))
430  lo = wrbuf_cstr(ar[i].term);
431  }
432  if (!lo)
433  break;
434  if (scan_save_set(zh, stream, nmem, kc, zapt, limit_set, lo,
435  index_type, ar, ord_no, glist,
436  (pos >= 0 && pos < *num_entries) ? pos : -1))
437  pos++;
438 
439  }
440  if (pos < *num_entries)
441  {
442  if (pos >= 0)
443  *num_entries = pos;
444  else
445  *num_entries = 0;
446  *is_partial = 1;
447  }
448 
449  *list = glist;
450 
451  for (i = 0; i < ord_no; i++)
452  wrbuf_destroy(ar[i].term);
453 
454  return ZEBRA_OK;
455 }
456 
458  char *term;
460 };
461 
462 struct scan_info {
464  ODR odr;
465  int before, after;
466  char prefix[20];
467 };
468 
469 ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
470  const Odr_oid *attributeset,
471  int num_bases, char **basenames,
472  int *position, int *num_entries, ZebraScanEntry **list,
473  int *is_partial, const char *set_name)
474 {
475  int base_no;
476  int ords[RPN_MAX_ORDS], ord_no = 0;
477 
478  const char *index_type;
479  char *search_type = NULL;
480  char rank_type[128];
481  int complete_flag;
482  int sort_flag;
483  NMEM nmem;
484  ZEBRA_RES res;
485  struct rset_key_control *kc = 0;
486  RSET limit_set = 0;
487 
488  *list = 0;
489  *is_partial = 0;
490 
491  if (!attributeset)
492  attributeset = yaz_oid_attset_bib_1;
493 
494  if (!set_name)
495  {
496  /* see if there is a @attr 8=set */
497  AttrType termset;
498  int termset_value_numeric;
499  const char *termset_value_string = 0;
500  attr_init_APT(&termset, zapt, 8);
501  termset_value_numeric =
502  attr_find_ex(&termset, NULL, &termset_value_string);
503  if (termset_value_numeric != -1)
504  {
505  if (termset_value_numeric != -2)
506  {
507  char resname[32];
508  sprintf(resname, "%d", termset_value_numeric);
509  set_name = odr_strdup(stream, resname);
510  }
511  else
512  set_name = odr_strdup(stream, termset_value_string);
513  }
514  }
515 
516  if (set_name)
517  {
518  limit_set = resultSetRef(zh, set_name);
519 
520  if (!limit_set)
521  {
522  zebra_setError(zh,
523  YAZ_BIB1_SPECIFIED_RESULT_SET_DOES_NOT_EXIST,
524  set_name);
525  return ZEBRA_FAIL;
526  }
527  }
528 
529  yaz_log(YLOG_DEBUG, "position = %d, num = %d",
530  *position, *num_entries);
531 
532  if (zebra_maps_attr(zh->reg->zebra_maps, zapt, &index_type, &search_type,
533  rank_type, &complete_flag, &sort_flag))
534  {
535  *num_entries = 0;
536  zebra_setError(zh, YAZ_BIB1_UNSUPP_ATTRIBUTE_TYPE, 0);
537  return ZEBRA_FAIL;
538  }
539  if (num_bases > RPN_MAX_ORDS)
540  {
541  zebra_setError(zh, YAZ_BIB1_TOO_MANY_DATABASES_SPECIFIED, 0);
542  return ZEBRA_FAIL;
543  }
544  for (base_no = 0; base_no < num_bases; base_no++)
545  {
546  int ord;
547 
548  if (zebraExplain_curDatabase(zh->reg->zei, basenames[base_no]))
549  {
550  zebra_setError(zh, YAZ_BIB1_DATABASE_UNAVAILABLE,
551  basenames[base_no]);
552  *num_entries = 0;
553  return ZEBRA_FAIL;
554  }
555  if (zebra_apt_get_ord(zh, zapt, index_type, 0, attributeset, &ord)
556  != ZEBRA_OK)
557  continue;
558  ords[ord_no++] = ord;
559  }
560  if (ord_no == 0)
561  {
562  *num_entries = 0; /* zebra_apt_get_ord should set error reason */
563  return ZEBRA_FAIL;
564  }
565  if (*num_entries < 1)
566  {
567  *num_entries = 0;
568  return ZEBRA_OK;
569  }
570  nmem = nmem_create();
571  kc = zebra_key_control_create(zh);
572 
573  res = rpn_scan_norm(zh, stream, nmem, kc, zapt, position, num_entries,
574  list, is_partial, limit_set,
575  index_type, ord_no, ords);
576  nmem_destroy(nmem);
577  (*kc->dec)(kc);
578  return res;
579 }
580 
581 /*
582  * Local variables:
583  * c-basic-offset: 4
584  * c-file-style: "Stroustrup"
585  * indent-tabs-mode: nil
586  * End:
587  * vim: shiftwidth=4 tabstop=8 expandtab
588  */
589 
Definition: rpnscan.c:133
void zebra_setError(ZebraHandle zh, int code, const char *addinfo)
Definition: zebraapi.c:2754
int len
Definition: it_key.h:31
#define ZEBRA_OK
Definition: util.h:82
RSET resultSetRef(ZebraHandle zh, const char *resultSetId)
Definition: zsets.c:1075
struct rset_key_control * zebra_key_control_create(ZebraHandle zh)
Definition: kcontrol.c:57
zint ISAM_P
Definition: isamc.h:28
struct rset rset
int m_staticrank
Definition: index.h:205
int ord
Definition: rpnscan.c:138
int ord
Definition: rset.h:36
RSET rset_dup(RSET rs)
Duplicate an RSET.
Definition: rset.c:255
RSET rset_trunc(ZebraHandle zh, ISAM_P *isam_p, int no, const char *term, int length_term, const char *flags, int preserve_position, int term_type, NMEM rset_nmem, struct rset_key_control *kctrl, int scope, struct ord_list *ol, const char *index_type, zint hits_limit, const char *term_ref_id)
Definition: trunc.c:403
int attr_find(AttrType *src, const Odr_oid **attribute_set_oid)
Definition: attrfind.c:99
void zebra_count_set(ZebraHandle zh, RSET rset, zint *count, zint approx_limit)
Definition: zsets.c:1498
char prefix[20]
Definition: rpnscan.c:135
struct zebra_register * reg
Definition: index.h:174
ZEBRA_RES zapt_term_to_utf8(ZebraHandle zh, Z_AttributesPlusTerm *zapt, char *termz)
Definition: zaptterm.c:32
void rpn_char_map_prepare(struct zebra_register *reg, zebra_map_t zm, struct rpn_char_map_info *map_info)
Definition: rpnsearch.c:64
#define ZEBRA_FAIL
Definition: util.h:81
int zebra_maps_attr(zebra_maps_t zms, Z_AttributesPlusTerm *zapt, const char **reg_id, char **search_type, char *rank_type, int *complete_flag, int *sort_flag)
Definition: zebramap.c:514
#define RSETF_READ
Definition: rset.h:199
ZebraHandle zh
Definition: zebrash.c:64
int zebra_get_rec_snippets(ZebraHandle zh, zint sysno, zebra_snippets *snippets)
Definition: retrieve.c:490
#define rset_open(rs, wflag)
Definition: rset.h:202
char * term
Definition: api.h:64
ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh, Z_AttributesPlusTerm *zapt, const char *index_type, const char *xpath_use, const Odr_oid *curAttributeSet, int *ord)
Definition: attribute.c:135
ODR odr
Definition: rpnscan.c:464
void zebra_snippets_destroy(zebra_snippets *l)
Definition: snippet.c:45
const char * CHR_SPACE
Definition: charmap.c:49
int before
Definition: rpnscan.c:465
int pos_to_save
Definition: rpnscan.c:137
zebra_map_t zm
Definition: index.h:400
static int scan_save_set(ZebraHandle zh, ODR stream, NMEM nmem, struct rset_key_control *kc, Z_AttributesPlusTerm *zapt, RSET limit_set, const char *term, const char *index_type, struct scan2_info_entry *ar, int ord_no, ZebraScanEntry *glist, int pos)
Definition: rpnscan.c:161
#define IT_MAX_WORD
Definition: it_key.h:27
struct ord_list * ord_list_create(NMEM nmem)
Definition: rset.c:301
static ZEBRA_RES trans_scan_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, char *termz, zebra_map_t zm)
Definition: rpnscan.c:45
void rset_delete(RSET rs)
Destructor RSETs.
Definition: rset.c:218
#define rset_read(rfd, buf, term)
Definition: rset.h:217
const char ** zebra_maps_input(zebra_map_t zm, const char **from, int len, int first)
Definition: zebramap.c:398
int zebra_maps_is_icu(zebra_map_t zm)
Definition: zebramap.c:740
int attr_find_ex(AttrType *src, const Odr_oid **attribute_set_oid, const char **string_value)
Definition: attrfind.c:45
ZebraExplainInfo zei
Definition: index.h:139
int zebra_map_tokenize_start(zebra_map_t zm, const char *buf, size_t len)
Definition: zebramap.c:701
WRBUF term
Definition: rpnscan.c:134
struct ord_list * ol
Definition: rset.h:64
RSET rset_create_and(NMEM nmem, struct rset_key_control *kcontrol, int scope, int no_rsets, RSET *rsets)
Definition: rsmultiandor.c:280
int zebra_map_tokenize_next(zebra_map_t zm, const char **result_buf, size_t *result_len, const char **display_buf, size_t *display_len)
Definition: zebramap.c:657
zebra_maps_t zebra_maps
Definition: index.h:143
void attr_init_APT(AttrType *src, Z_AttributesPlusTerm *zapt, int type)
Definition: attrfind.c:27
const struct zebra_snippet_word * zebra_snippets_lookup(const zebra_snippets *doc, const zebra_snippets *hit)
Definition: snippet.c:218
Definition: rpnscan.c:457
zebra_map_t zebra_map_get_or_add(zebra_maps_t zms, const char *id)
Definition: zebramap.c:363
int zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream, const char *index_type, char **dst, const char *src)
Definition: untrans.c:64
static ZEBRA_RES rpn_scan_norm(ZebraHandle zh, ODR stream, NMEM nmem, struct rset_key_control *kc, Z_AttributesPlusTerm *zapt, int *position, int *num_entries, ZebraScanEntry **list, int *is_partial, RSET limit_set, const char *index_type, int ord_no, int *ords)
Definition: rpnscan.c:284
#define RPN_MAX_ORDS
Definition: rpnscan.c:42
ISAM_P isam_p
Definition: rpnscan.c:459
int dict_scan(Dict dict, char *str, int *before, int *after, void *client, int(*f)(char *name, const char *info, int pos, void *client))
dictionary scan
Definition: scan.c:242
static int scan_handle2(char *name, const char *info, int pos, void *client)
Definition: rpnscan.c:141
int zebraExplain_curDatabase(ZebraExplainInfo zei, const char *database)
Definition: zinfo.c:791
void(* dec)(struct rset_key_control *kc)
Definition: rset.h:138
void zebra_snippets_append(zebra_snippets *l, zint seqno, int ws, int ord, const char *term)
Definition: snippet.c:51
zint mem[IT_KEY_LEVEL_MAX]
Definition: it_key.h:32
struct ord_list * next
Definition: rset.h:37
#define FIRST_IN_FIELD_STR
Definition: index.h:415
Dict dict
Definition: index.h:132
char * term
Definition: rpnscan.c:458
int key_SU_encode(int ch, char *out)
Definition: su_codec.c:31
static void get_first_snippet_from_rset(ZebraHandle zh, RSET rset, zebra_snippets *snippets, zint *sysno)
Definition: rpnscan.c:96
long zint
Zebra integer.
Definition: util.h:66
RSET rset_create_or(NMEM nmem, struct rset_key_control *kcontrol, int scope, TERMID termid, int no_rsets, RSET *rsets)
Definition: rsmultiandor.c:273
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, const Odr_oid *attributeset, int num_bases, char **basenames, int *position, int *num_entries, ZebraScanEntry **list, int *is_partial, const char *set_name)
Definition: rpnscan.c:469
ISAM_P isam_p
Definition: rpnscan.c:136
Definition: rset.h:73
Definition: rset.h:150
struct scan1_info_entry * list
Definition: rpnscan.c:463
char * display_term
Definition: api.h:65
zebra_snippets * zebra_snippets_create(void)
Definition: snippet.c:36
struct ord_list * ord_list_append(NMEM nmem, struct ord_list *list, int ord)
Definition: rset.c:306
Definition: it_key.h:30
short ZEBRA_RES
Common return type for Zebra API.
Definition: util.h:80
void rset_close(RSFD rfd)
Closes a result set RFD handle.
Definition: rset.c:98
Definition: rset.h:50
Definition: rset.h:35
zint occurrences
Definition: api.h:63
zint approx_limit
Definition: index.h:180
char * name
Definition: rset.h:51