2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.25 1995-10-10 13:59:24 adam
8 * Function rset_open changed its wflag parameter to general flags.
10 * Revision 1.24 1995/10/09 16:18:37 adam
11 * Function dict_lookup_grep got extra client data parameter.
13 * Revision 1.23 1995/10/06 16:33:37 adam
14 * Use attribute mappings.
16 * Revision 1.22 1995/10/06 15:07:39 adam
17 * Structure 'local-number' handled.
19 * Revision 1.21 1995/10/06 13:52:06 adam
20 * Bug fixes. Handler may abort further scanning.
22 * Revision 1.20 1995/10/06 11:06:33 adam
23 * Scan entries include 'occurrences' now.
25 * Revision 1.19 1995/10/06 10:43:56 adam
26 * Scan added. 'occurrences' in scan entries not set yet.
28 * Revision 1.18 1995/10/04 16:57:20 adam
29 * Key input and merge sort in one pass.
31 * Revision 1.17 1995/10/04 12:55:17 adam
32 * Bug fix in ranked search. Use=Any keys inserted.
34 * Revision 1.16 1995/10/02 16:24:40 adam
35 * Use attribute actually used in search requests.
37 * Revision 1.15 1995/10/02 15:18:52 adam
38 * New member in recRetrieveCtrl: diagnostic.
40 * Revision 1.14 1995/09/28 12:10:32 adam
41 * Bug fixes. Field prefix used in queries.
43 * Revision 1.13 1995/09/18 14:17:50 adam
46 * Revision 1.12 1995/09/15 14:45:21 adam
50 * Revision 1.11 1995/09/14 11:53:27 adam
51 * First work on regular expressions/truncations.
53 * Revision 1.10 1995/09/11 15:23:26 adam
54 * More work on relevance search.
56 * Revision 1.9 1995/09/11 13:09:35 adam
57 * More work on relevance feedback.
59 * Revision 1.8 1995/09/08 14:52:27 adam
60 * Minor changes. Dictionary is lower case now.
62 * Revision 1.7 1995/09/07 13:58:36 adam
63 * New parameter: result-set file descriptor (RSFD) to support multiple
64 * positions within the same result-set.
65 * Boolean operators: and, or, not implemented.
66 * Result-set references.
68 * Revision 1.6 1995/09/06 16:11:18 adam
69 * Option: only one word key per file.
71 * Revision 1.5 1995/09/06 10:33:04 adam
72 * More work on present. Some log messages removed.
74 * Revision 1.4 1995/09/05 15:28:40 adam
75 * More work on search engine.
77 * Revision 1.3 1995/09/04 15:20:22 adam
80 * Revision 1.2 1995/09/04 12:33:43 adam
81 * Various cleanup. YAZ util used instead.
83 * Revision 1.1 1995/09/04 09:10:40 adam
84 * More work on index add/del/update.
85 * Merge sort implemented.
86 * Initial work on z39 server.
94 #include <attribute.h>
102 int index_word_prefix_map (char *string, oid_value attrSet, int attrUse)
106 logf (LOG_DEBUG, "oid_value attrSet = %d, attrUse = %d", attrSet, attrUse);
107 attp = att_getentbyatt (attrSet, attrUse);
110 logf (LOG_DEBUG, "ord=%d", attp->attset_ordinal);
111 return index_word_prefix (string, attp->attset_ordinal,
112 attp->local_attribute);
116 * attr_print: log attributes
118 static void attr_print (Z_AttributesPlusTerm *t)
121 for (of = 0; of < t->num_attributes; of++)
123 Z_AttributeElement *element;
124 element = t->attributeList[of];
126 switch (element->which)
128 case Z_AttributeValue_numeric:
129 logf (LOG_DEBUG, "attributeType=%d value=%d",
130 *element->attributeType,
131 *element->value.numeric);
133 case Z_AttributeValue_complex:
134 logf (LOG_DEBUG, "attributeType=%d complex",
135 *element->attributeType);
136 for (i = 0; i<element->value.complex->num_list; i++)
138 if (element->value.complex->list[i]->which ==
139 Z_StringOrNumeric_string)
140 logf (LOG_DEBUG, " string: '%s'",
141 element->value.complex->list[i]->u.string);
142 else if (element->value.complex->list[i]->which ==
143 Z_StringOrNumeric_numeric)
144 logf (LOG_DEBUG, " numeric: '%d'",
145 *element->value.complex->list[i]->u.numeric);
158 Z_AttributesPlusTerm *zapt;
161 static int attr_find (AttrType *src, oid_value *attributeSetP)
163 while (src->major < src->zapt->num_attributes)
165 Z_AttributeElement *element;
167 element = src->zapt->attributeList[src->major];
168 if (src->type == *element->attributeType)
170 switch (element->which)
172 case Z_AttributeValue_numeric:
174 if (element->attributeSet && attributeSetP)
178 attrset = oid_getentbyoid (element->attributeSet);
179 *attributeSetP = attrset->value;
181 return *element->value.numeric;
183 case Z_AttributeValue_complex:
184 if (src->minor >= element->value.complex->num_list ||
185 element->value.complex->list[src->minor]->which !=
186 Z_StringOrNumeric_numeric)
189 if (element->attributeSet && attributeSetP)
193 attrset = oid_getentbyoid (element->attributeSet);
194 *attributeSetP = attrset->value;
196 return *element->value.complex->list[src->minor-1]->u.numeric;
206 static void attr_init (AttrType *src, Z_AttributesPlusTerm *zapt,
219 int (*cmp)(const void *p1, const void *p2);
226 static void heap_swap (struct trunc_info *ti, int i1, int i2)
230 memcpy (ti->swapbuf, ti->heap[i1], ti->keysize);
231 memcpy (ti->heap[i1], ti->heap[i2], ti->keysize);
232 memcpy (ti->heap[i2], ti->swapbuf, ti->keysize);
235 ti->indx[i1] = ti->indx[i2];
239 static void heap_delete (struct trunc_info *ti)
241 int cur = 1, child = 2;
243 assert (ti->heapnum > 0);
244 memcpy (ti->heap[1], ti->heap[ti->heapnum], ti->keysize);
245 ti->indx[1] = ti->indx[ti->heapnum--];
246 while (child <= ti->heapnum) {
247 if (child < ti->heapnum &&
248 (*ti->cmp)(ti->heap[child], ti->heap[1+child]) > 0)
250 if ((*ti->cmp)(ti->heap[cur], ti->heap[child]) > 0)
252 heap_swap (ti, cur, child);
261 static void heap_insert (struct trunc_info *ti, const char *buf, int indx)
265 cur = ++(ti->heapnum);
266 memcpy (ti->heap[cur], buf, ti->keysize);
267 ti->indx[cur] = indx;
269 while (parent && (*ti->cmp)(ti->heap[parent], ti->heap[cur]) > 0)
271 heap_swap (ti, cur, parent);
278 struct trunc_info *heap_init (int size, int key_size,
279 int (*cmp)(const void *p1, const void *p2))
281 struct trunc_info *ti = xmalloc (sizeof(*ti));
286 ti->keysize = key_size;
288 ti->indx = xmalloc (size * sizeof(*ti->indx));
289 ti->heap = xmalloc (size * sizeof(*ti->heap));
290 ti->swapbuf = xmalloc (ti->keysize);
291 ti->tmpbuf = xmalloc (ti->keysize);
292 ti->buf = xmalloc (size * ti->keysize);
293 for (i = size; --i >= 0; )
294 ti->heap[i] = ti->buf + ti->keysize * i;
298 static void heap_close (struct trunc_info *ti)
307 static RSET rset_trunc (ISAM isam, ISAM_P *isam_p, int from, int to,
310 logf (LOG_DEBUG, "rset_trunc, range=%d-%d", from, to-1);
311 if (to - from > merge_chunk)
319 struct trunc_info *ti;
322 rset_temp_parms parms;
324 ispt = xmalloc (sizeof(*ispt) * (to-from));
325 parms.key_size = sizeof (struct it_key);
326 result = rset_create (rset_kind_temp, &parms);
327 rsfd = rset_open (result, RSETF_WRITE|RSETF_SORT_SYSNO);
329 ti = heap_init (to-from, sizeof(struct it_key),
331 for (i = to-from; --i >= 0; )
333 ispt[i] = is_position (isam, isam_p[from+i]);
334 if (is_readkey (ispt[i], ti->tmpbuf))
335 heap_insert (ti, ti->tmpbuf, i);
341 rset_write (result, rsfd, ti->heap[1]);
343 if (is_readkey (ispt[n], ti->tmpbuf))
344 heap_insert (ti, ti->tmpbuf, n);
346 for (i = to-from; --i >= 0; )
347 is_pt_free (ispt[i]);
348 rset_close (result, rsfd);
361 static void add_isam_p (const char *info, struct grep_info *p)
363 if (p->isam_p_indx == p->isam_p_size)
365 ISAM_P *new_isam_p_buf;
367 p->isam_p_size = 2*p->isam_p_size + 100;
368 new_isam_p_buf = xmalloc (sizeof(*new_isam_p_buf) *
372 memcpy (new_isam_p_buf, p->isam_p_buf,
373 p->isam_p_indx * sizeof(*p->isam_p_buf));
374 xfree (p->isam_p_buf);
376 p->isam_p_buf = new_isam_p_buf;
378 assert (*info == sizeof(*p->isam_p_buf));
379 memcpy (p->isam_p_buf + p->isam_p_indx, info+1, sizeof(*p->isam_p_buf));
383 static int grep_handle (Dict_char *name, const char *info, void *p)
385 logf (LOG_DEBUG, "dict name: %s", name);
386 add_isam_p (info, p);
390 static int trunc_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
391 const char *term_sub,
392 oid_value attributeSet, struct grep_info *grep_info)
394 char term_dict[2*IT_MAX_WORD+2];
398 int truncation_value;
401 oid_value curAttributeSet = attributeSet;
403 attr_init (&use, zapt, 1);
404 use_value = attr_find (&use, &curAttributeSet);
405 logf (LOG_DEBUG, "use value %d", use_value);
406 attr_init (&truncation, zapt, 5);
407 truncation_value = attr_find (&truncation, NULL);
408 logf (LOG_DEBUG, "truncation value %d", truncation_value);
412 i = index_word_prefix_map (term_dict, curAttributeSet, use_value);
419 switch (truncation_value)
421 case -1: /* not specified */
422 case 100: /* do not truncate */
423 strcat (term_dict, term_sub);
424 logf (LOG_DEBUG, "dict_lookup: %s", term_dict);
425 if ((info = dict_lookup (zi->wordDict, term_dict)))
426 add_isam_p (info, grep_info);
428 case 1: /* right truncation */
429 strcat (term_dict, term_sub);
430 strcat (term_dict, ".*");
431 dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle);
433 case 2: /* left truncation */
434 case 3: /* left&right truncation */
437 case 101: /* process # in term */
438 for (j = strlen(term_dict), i = 0; term_sub[i] && i < 2; i++)
439 term_dict[j++] = term_sub[i];
440 for (; term_sub[i]; i++)
441 if (term_sub[i] == '#')
443 term_dict[j++] = '.';
444 term_dict[j++] = '*';
447 term_dict[j++] = term_sub[i];
449 dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle);
451 case 102: /* regular expression */
452 strcat (term_dict, term_sub);
453 dict_lookup_grep (zi->wordDict, term_dict, 0, grep_info, grep_handle);
456 logf (LOG_DEBUG, "%d positions", grep_info->isam_p_indx);
460 static void trans_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
464 Z_Term *term = zapt->term;
466 sizez = term->u.general->len;
467 if (sizez > IT_MAX_WORD)
469 for (i = 0; i < sizez; i++)
470 termz[i] = index_char_cvt (term->u.general->buf[i]);
474 static RSET rpn_search_APT_relevance (ZServerInfo *zi,
475 Z_AttributesPlusTerm *zapt,
476 oid_value attributeSet)
478 rset_relevance_parms parms;
479 char termz[IT_MAX_WORD+1];
480 char term_sub[IT_MAX_WORD+1];
481 struct grep_info grep_info;
482 char *p0 = termz, *p1 = NULL;
485 parms.key_size = sizeof(struct it_key);
487 parms.cmp = key_compare;
488 parms.is = zi->wordIsam;
490 if (zapt->term->which != Z_Term_general)
495 trans_term (zi, zapt, termz);
496 grep_info.isam_p_indx = 0;
497 grep_info.isam_p_size = 0;
498 grep_info.isam_p_buf = NULL;
501 if ((p1 = strchr (p0, ' ')))
503 memcpy (term_sub, p0, p1-p0);
504 term_sub[p1-p0] = '\0';
507 strcpy (term_sub, p0);
508 if (trunc_term (zi, zapt, term_sub, attributeSet, &grep_info))
516 parms.isam_positions = grep_info.isam_p_buf;
517 parms.no_isam_positions = grep_info.isam_p_indx;
518 if (grep_info.isam_p_indx > 0)
519 result = rset_create (rset_kind_relevance, &parms);
521 result = rset_create (rset_kind_null, NULL);
522 xfree (grep_info.isam_p_buf);
526 static RSET rpn_search_APT_word (ZServerInfo *zi,
527 Z_AttributesPlusTerm *zapt,
528 oid_value attributeSet)
530 rset_isam_parms parms;
531 char termz[IT_MAX_WORD+1];
532 struct grep_info grep_info;
535 if (zapt->term->which != Z_Term_general)
540 trans_term (zi, zapt, termz);
542 grep_info.isam_p_indx = 0;
543 grep_info.isam_p_size = 0;
544 grep_info.isam_p_buf = NULL;
546 if (trunc_term (zi, zapt, termz, attributeSet, &grep_info))
548 if (grep_info.isam_p_indx < 1)
549 result = rset_create (rset_kind_null, NULL);
550 else if (grep_info.isam_p_indx == 1)
552 parms.is = zi->wordIsam;
553 parms.pos = *grep_info.isam_p_buf;
554 result = rset_create (rset_kind_isam, &parms);
557 result = rset_trunc (zi->wordIsam, grep_info.isam_p_buf, 0,
558 grep_info.isam_p_indx, 400);
559 xfree (grep_info.isam_p_buf);
563 static RSET rpn_prox (RSET *rset, int rset_no)
571 rset_temp_parms parms;
573 rsfd = xmalloc (sizeof(*rsfd)*rset_no);
574 more = xmalloc (sizeof(*more)*rset_no);
575 buf = xmalloc (sizeof(*buf)*rset_no);
577 for (i = 0; i<rset_no; i++)
579 buf[i] = xmalloc (sizeof(**buf));
580 rsfd[i] = rset_open (rset[i], RSETF_READ|RSETF_SORT_SYSNO);
581 more[i] = rset_read (rset[i], rsfd[i], buf[i]);
583 parms.key_size = sizeof (struct it_key);
584 result = rset_create (rset_kind_temp, &parms);
585 rsfd_result = rset_open (result, RSETF_WRITE|RSETF_SORT_SYSNO);
589 for (i = 1; i<rset_no; i++)
598 cmp = key_compare (buf[i], buf[i-1]);
601 more[i-1] = rset_read (rset[i-1], rsfd[i-1], buf[i-1]);
606 if (buf[i-1]->seqno+1 != buf[i]->seqno)
608 more[i-1] = rset_read (rset[i-1], rsfd[i-1], buf[i-1]);
614 more[i] = rset_read (rset[i], rsfd[i], buf[i]);
620 rset_write (result, rsfd_result, buf[0]);
621 more[0] = rset_read (*rset, *rsfd, *buf);
625 for (i = 0; i<rset_no; i++)
627 rset_close (rset[i], rsfd[i]);
630 rset_close (result, rsfd_result);
637 static RSET rpn_search_APT_phrase (ZServerInfo *zi,
638 Z_AttributesPlusTerm *zapt,
639 oid_value attributeSet)
641 char termz[IT_MAX_WORD+1];
642 char term_sub[IT_MAX_WORD+1];
643 char *p0 = termz, *p1 = NULL;
644 RSET rset[60], result;
646 struct grep_info grep_info;
648 if (zapt->term->which != Z_Term_general)
653 trans_term (zi, zapt, termz);
655 grep_info.isam_p_size = 0;
656 grep_info.isam_p_buf = NULL;
660 if ((p1 = strchr (p0, ' ')))
662 memcpy (term_sub, p0, p1-p0);
663 term_sub[p1-p0] = '\0';
666 strcpy (term_sub, p0);
668 grep_info.isam_p_indx = 0;
669 if (trunc_term (zi, zapt, term_sub, attributeSet, &grep_info))
671 if (grep_info.isam_p_indx > 0)
673 if (grep_info.isam_p_indx > 1)
674 rset[rset_no] = rset_trunc (zi->wordIsam,
675 grep_info.isam_p_buf, 0,
676 grep_info.isam_p_indx, 400);
679 rset_isam_parms parms;
681 parms.is = zi->wordIsam;
682 parms.pos = *grep_info.isam_p_buf;
683 rset[rset_no] = rset_create (rset_kind_isam, &parms);
686 if (rset_no >= sizeof(rset)/sizeof(*rset))
695 xfree (grep_info.isam_p_buf);
697 return rset_create (rset_kind_null, NULL);
698 else if (rset_no == 1)
701 result = rpn_prox (rset, rset_no);
702 for (i = 0; i<rset_no; i++)
703 rset_delete (rset[i]);
707 static RSET rpn_search_APT_local (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
708 oid_value attributeSet)
713 rset_temp_parms parms;
714 char termz[IT_MAX_WORD+1];
716 if (zapt->term->which != Z_Term_general)
721 parms.key_size = sizeof (struct it_key);
722 result = rset_create (rset_kind_temp, &parms);
723 rsfd = rset_open (result, RSETF_WRITE|RSETF_SORT_SYSNO);
725 trans_term (zi, zapt, termz);
726 key.sysno = atoi (termz);
729 rset_write (result, rsfd, &key);
730 rset_close (result, rsfd);
735 static RSET rpn_search_APT (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
736 oid_value attributeSet)
740 int relation_value, structure_value;
742 attr_init (&relation, zapt, 2);
743 attr_init (&structure, zapt, 4);
745 relation_value = attr_find (&relation, NULL);
746 structure_value = attr_find (&structure, NULL);
747 switch (structure_value)
750 if (relation_value == 102) /* relevance relation */
751 return rpn_search_APT_relevance (zi, zapt, attributeSet);
752 return rpn_search_APT_phrase (zi, zapt, attributeSet);
754 if (relation_value == 102) /* relevance relation */
755 return rpn_search_APT_relevance (zi, zapt, attributeSet);
756 return rpn_search_APT_phrase (zi, zapt, attributeSet);
759 if (relation_value == 102) /* relevance relation */
760 return rpn_search_APT_relevance (zi, zapt, attributeSet);
761 return rpn_search_APT_word (zi, zapt, attributeSet);
766 case 5: /* date - normalized */
768 case 6: /* word list */
769 return rpn_search_APT_relevance (zi, zapt, attributeSet);
770 case 100: /* date - un-normalized */
772 case 101: /* name - normalized */
774 case 102: /* date - un-normalized */
776 case 103: /* structure */
780 case 105: /* free-form-text */
781 return rpn_search_APT_relevance (zi, zapt, attributeSet);
782 case 106: /* document-text */
783 return rpn_search_APT_relevance (zi, zapt, attributeSet);
784 case 107: /* local-number */
785 return rpn_search_APT_local (zi, zapt, attributeSet);
786 case 108: /* string */
787 return rpn_search_APT_word (zi, zapt, attributeSet);
788 case 109: /* numeric string */
795 static RSET rpn_search_ref (ZServerInfo *zi, Z_ResultSetId *resultSetId)
799 if (!(s = resultSetGet (zi, resultSetId)))
800 return rset_create (rset_kind_null, NULL);
804 static RSET rpn_search_structure (ZServerInfo *zi, Z_RPNStructure *zs,
805 oid_value attributeSet)
808 if (zs->which == Z_RPNStructure_complex)
810 rset_bool_parms bool_parms;
812 bool_parms.rset_l = rpn_search_structure (zi, zs->u.complex->s1,
814 if (bool_parms.rset_l == NULL)
816 bool_parms.rset_r = rpn_search_structure (zi, zs->u.complex->s2,
818 if (bool_parms.rset_r == NULL)
820 rset_delete (bool_parms.rset_l);
823 bool_parms.key_size = sizeof(struct it_key);
824 bool_parms.cmp = key_compare;
826 switch (zs->u.complex->operator->which)
829 r = rset_create (rset_kind_and, &bool_parms);
832 r = rset_create (rset_kind_or, &bool_parms);
834 case Z_Operator_and_not:
835 r = rset_create (rset_kind_not, &bool_parms);
841 else if (zs->which == Z_RPNStructure_simple)
843 if (zs->u.simple->which == Z_Operand_APT)
845 logf (LOG_DEBUG, "rpn_search_APT");
846 r = rpn_search_APT (zi, zs->u.simple->u.attributesPlusTerm,
849 else if (zs->u.simple->which == Z_Operand_resultSetId)
851 logf (LOG_DEBUG, "rpn_search_ref");
852 r = rpn_search_ref (zi, zs->u.simple->u.resultSetId);
866 static void count_set (RSET r, int *count)
872 logf (LOG_DEBUG, "rpn_save_set");
874 rfd = rset_open (r, RSETF_READ|RSETF_SORT_SYSNO);
875 while (rset_read (r, rfd, &key))
877 if (key.sysno != psysno)
884 logf (LOG_DEBUG, "%d distinct sysnos", *count);
887 int rpn_search (ZServerInfo *zi,
888 Z_RPNQuery *rpn, int num_bases, char **basenames,
889 const char *setname, int *hits)
893 oid_value attributeSet;
896 zi->errString = NULL;
898 attrset = oid_getentbyoid (rpn->attributeSetId);
899 attributeSet = attrset->value;
901 rset = rpn_search_structure (zi, rpn->RPNStructure, attributeSet);
904 count_set (rset, hits);
905 resultSetAdd (zi, setname, 1, rset);
907 logf (LOG_DEBUG, "search error: %d", zi->errCode);
912 struct scan_entry *list;
919 static int scan_handle (Dict_char *name, const char *info, int pos,
925 struct scan_info *scan_info = client;
927 rset_isam_parms parms;
929 len_prefix = strlen(scan_info->prefix);
930 if (memcmp (name, scan_info->prefix, len_prefix))
933 idx = scan_info->after - pos + scan_info->before;
936 scan_info->list[idx].term = odr_malloc (scan_info->odr,
937 strlen(name + len_prefix)+1);
938 strcpy (scan_info->list[idx].term, name + len_prefix);
939 assert (*info == sizeof(isam_p));
940 memcpy (&isam_p, info+1, sizeof(isam_p));
941 parms.is = scan_info->isam;
944 rset = rset_create (rset_kind_isam, &parms);
945 count_set (rset, &scan_info->list[idx].occurrences);
948 scan_info->list[idx].occurrences = 1;
950 logf (LOG_DEBUG, "pos=%3d idx=%3d name=%s", pos, idx, name);
954 int rpn_scan (ZServerInfo *zi, ODR odr, Z_AttributesPlusTerm *zapt,
955 int *position, int *num_entries, struct scan_entry **list,
960 int num = *num_entries;
963 char termz[IT_MAX_WORD+20];
966 Z_Term *term = zapt->term;
967 struct scan_info scan_info;
969 logf (LOG_DEBUG, "scan, position = %d, num = %d", pos, num);
970 scan_info.before = before = pos-1;
971 scan_info.after = after = 1+num-pos;
974 logf (LOG_DEBUG, "scan, before = %d, after = %d", before, after);
976 scan_info.isam = zi->wordIsam;
977 scan_info.list = odr_malloc (odr, (before+after)*sizeof(*scan_info.list));
978 for (j = 0; j<before+after; j++)
979 scan_info.list[j].term = NULL;
980 attr_init (&use, zapt, 1);
981 use_value = attr_find (&use, NULL);
982 logf (LOG_DEBUG, "use value %d", use_value);
986 i = index_word_prefix (termz, 1, use_value);
987 strcpy (scan_info.prefix, termz);
988 sizez = term->u.general->len;
989 if (sizez > IT_MAX_WORD)
991 for (j = 0; j<sizez; j++)
992 termz[j+i] = index_char_cvt (term->u.general->buf[j]);
995 dict_scan (zi->wordDict, termz, &before, &after, &scan_info, scan_handle);
997 *status = BEND_SCAN_SUCCESS;
999 for (i = 0; i<scan_info.after; i++)
1000 if (scan_info.list[scan_info.before+scan_info.after-i-1].term)
1004 *status = BEND_SCAN_PARTIAL;
1006 for (i = 0; i<scan_info.before; i++)
1007 if (scan_info.list[i].term)
1010 *status = BEND_SCAN_PARTIAL;
1014 *list = scan_info.list+i; /* list is set to first 'real' entry */
1016 if (*num_entries == 0) /* signal 'unsupported use-attribute' */
1017 zi->errCode = 114; /* if no entries was found */
1018 logf (LOG_DEBUG, "position = %d, num_entries = %d",
1019 *position, *num_entries);
1021 logf (LOG_DEBUG, "scan error: %d", zi->errCode);