projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor database lookup to single function.
[idzebra-moved-to-github.git]
/
index
/
rpnscan.c
diff --git
a/index/rpnscan.c
b/index/rpnscan.c
index
d484132
..
839d88e
100644
(file)
--- a/
index/rpnscan.c
+++ b/
index/rpnscan.c
@@
-1,4
+1,4
@@
-/* $Id: rpnscan.c,v 1.13 2007-09-18 18:57:29 adam Exp $
+/* $Id: rpnscan.c,v 1.15 2007-10-29 16:57:53 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
Copyright (C) 1995-2007
Index Data ApS
@@
-45,7
+45,7
@@
int log_scan = YLOG_LOG;
/* convert APT SCAN term to internal cmap */
static ZEBRA_RES trans_scan_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
/* convert APT SCAN term to internal cmap */
static ZEBRA_RES trans_scan_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
- char *termz, int reg_type)
+ char *termz, const char *index_type)
{
char termz0[IT_MAX_WORD];
{
char termz0[IT_MAX_WORD];
@@
-63,7
+63,8
@@
static ZEBRA_RES trans_scan_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
while ((len = (cp_end - cp)) > 0)
{
while ((len = (cp_end - cp)) > 0)
{
- map = zebra_maps_input(zh->reg->zebra_maps, reg_type, &cp, len, 0);
+ map = zebra_maps_input(zh->reg->zebra_maps, *index_type,
+ &cp, len, 0);
if (**map == *CHR_SPACE)
space_map = *map;
else
if (**map == *CHR_SPACE)
space_map = *map;
else
@@
-102,7
+103,7
@@
static void count_set(ZebraHandle zh, RSET rset, zint *count)
break;
}
}
break;
}
}
- rset_close (rfd);
+ rset_close(rfd);
*count = rset->hits_count;
}
*count = rset->hits_count;
}
@@
-140,7
+141,7
@@
static void get_first_snippet_from_rset(ZebraHandle zh,
}
}
}
}
}
}
- rset_close (rfd);
+ rset_close(rfd);
}
struct scan2_info_entry {
}
struct scan2_info_entry {
@@
-160,7
+161,7
@@
static int scan_handle2(char *name, const char *info, int pos, void *client)
return 0;
len_prefix = strlen(scan_info->prefix);
return 0;
len_prefix = strlen(scan_info->prefix);
- if (memcmp (name, scan_info->prefix, len_prefix))
+ if (memcmp(name, scan_info->prefix, len_prefix))
return 1;
/* skip special terms such as first-in-field specials */
return 1;
/* skip special terms such as first-in-field specials */
@@
-170,8
+171,8
@@
static int scan_handle2(char *name, const char *info, int pos, void *client)
wrbuf_rewind(scan_info->term);
wrbuf_puts(scan_info->term, name+len_prefix);
wrbuf_rewind(scan_info->term);
wrbuf_puts(scan_info->term, name+len_prefix);
- assert (*info == sizeof(ISAM_P));
- memcpy (&scan_info->isam_p, info+1, sizeof(ISAM_P));
+ assert(*info == sizeof(ISAM_P));
+ memcpy(&scan_info->isam_p, info+1, sizeof(ISAM_P));
return 0;
}
return 0;
}
@@
-181,7
+182,7
@@
static int scan_save_set(ZebraHandle zh, ODR stream, NMEM nmem,
Z_AttributesPlusTerm *zapt,
RSET limit_set,
const char *term,
Z_AttributesPlusTerm *zapt,
RSET limit_set,
const char *term,
- int index_type,
+ const char *index_type,
struct scan2_info_entry *ar, int ord_no,
ZebraScanEntry *glist, int pos)
{
struct scan2_info_entry *ar, int ord_no,
ZebraScanEntry *glist, int pos)
{
@@
-257,7
+258,7
@@
static int scan_save_set(ZebraHandle zh, ODR stream, NMEM nmem,
}
}
if (!glist[pos].term)
}
}
if (!glist[pos].term)
- zebra_term_untrans_iconv(zh, stream->mem, index_type,
+ zebra_term_untrans_iconv(zh, stream->mem, *index_type,
&glist[pos].term, term);
glist[pos].occurrences = count;
zebra_snippets_destroy(rec_snippets);
&glist[pos].term, term);
glist[pos].occurrences = count;
zebra_snippets_destroy(rec_snippets);
@@
-278,7
+279,8
@@
static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem,
int *position, int *num_entries,
ZebraScanEntry **list,
int *is_partial, RSET limit_set,
int *position, int *num_entries,
ZebraScanEntry **list,
int *is_partial, RSET limit_set,
- int index_type, int ord_no, int *ords)
+ const char *index_type,
+ int ord_no, int *ords)
{
struct scan2_info_entry *ar = nmem_malloc(nmem, sizeof(*ar) * ord_no);
struct rpn_char_map_info rcmi;
{
struct scan2_info_entry *ar = nmem_malloc(nmem, sizeof(*ar) * ord_no);
struct rpn_char_map_info rcmi;
@@
-297,7
+299,7
@@
static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem,
*num_entries = 0;
return ZEBRA_OK;
}
*num_entries = 0;
return ZEBRA_OK;
}
- rpn_char_map_prepare (zh->reg, index_type, &rcmi);
+ rpn_char_map_prepare(zh->reg, *index_type, &rcmi);
for (i = 0; i < ord_no; i++)
ar[i].term = wrbuf_alloc();
for (i = 0; i < ord_no; i++)
ar[i].term = wrbuf_alloc();
@@
-307,7
+309,7
@@
static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem,
char termz[IT_MAX_WORD+20];
int prefix_len = 0;
char termz[IT_MAX_WORD+20];
int prefix_len = 0;
- prefix_len = key_SU_encode (ords[i], termz);
+ prefix_len = key_SU_encode(ords[i], termz);
termz[prefix_len] = 0;
strcpy(ar[i].prefix, termz);
termz[prefix_len] = 0;
strcpy(ar[i].prefix, termz);
@@
-377,7
+379,7
@@
static ZEBRA_RES rpn_scan_ver2(ZebraHandle zh, ODR stream, NMEM nmem,
char termz[IT_MAX_WORD+20];
int prefix_len = 0;
char termz[IT_MAX_WORD+20];
int prefix_len = 0;
- prefix_len = key_SU_encode (ords[i], termz);
+ prefix_len = key_SU_encode(ords[i], termz);
termz[prefix_len] = 0;
strcpy(ar[i].prefix, termz);
termz[prefix_len] = 0;
strcpy(ar[i].prefix, termz);
@@
-467,7
+469,7
@@
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
int base_no;
int ords[RPN_MAX_ORDS], ord_no = 0;
int base_no;
int ords[RPN_MAX_ORDS], ord_no = 0;
- unsigned index_type;
+ const char *index_type;
char *search_type = NULL;
char rank_type[128];
int complete_flag;
char *search_type = NULL;
char rank_type[128];
int complete_flag;
@@
-504,7
+506,7
@@
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
else
termset_name = termset_value_string;
else
termset_name = termset_value_string;
- limit_set = resultSetRef (zh, termset_name);
+ limit_set = resultSetRef(zh, termset_name);
if (!limit_set)
{
if (!limit_set)
{
@@
-536,7
+538,7
@@
ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
{
int ord;
{
int ord;
- if (zebraExplain_curDatabase (zh->reg->zei, basenames[base_no]))
+ if (zebraExplain_curDatabase(zh->reg->zei, basenames[base_no]))
{
zebra_setError(zh, YAZ_BIB1_DATABASE_UNAVAILABLE,
basenames[base_no]);
{
zebra_setError(zh, YAZ_BIB1_DATABASE_UNAVAILABLE,
basenames[base_no]);