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
Remove isamd. It's not been in use for a long time and isamb is better
[idzebra-moved-to-github.git]
/
index
/
zsets.c
diff --git
a/index/zsets.c
b/index/zsets.c
index
cf0e7d0
..
a26ac40
100644
(file)
--- a/
index/zsets.c
+++ b/
index/zsets.c
@@
-1,4
+1,4
@@
-/* $Id: zsets.c,v 1.47 2004-05-10 08:47:54 adam Exp $
+/* $Id: zsets.c,v 1.50 2004-08-04 08:35:24 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
@@
-58,7
+58,7
@@
struct zebra_set {
};
struct zset_sort_entry {
};
struct zset_sort_entry {
- int sysno;
+ zint sysno;
int score;
char buf[ZSET_SORT_MAX_LEVEL][SORT_IDX_ENTRYSIZE];
};
int score;
char buf[ZSET_SORT_MAX_LEVEL][SORT_IDX_ENTRYSIZE];
};
@@
-207,6
+207,8
@@
ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov)
}
else
{
}
else
{
+ const char *sort_max_str = zebra_get_resource(zh, "sortmax", "1000");
+
yaz_log (LOG_DEBUG, "adding result set %s", name);
s = (ZebraSet) xmalloc (sizeof(*s));
s->next = zh->sets;
yaz_log (LOG_DEBUG, "adding result set %s", name);
s = (ZebraSet) xmalloc (sizeof(*s));
s->next = zh->sets;
@@
-216,7
+218,10
@@
ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov)
s->sort_info = (struct zset_sort_info *)
xmalloc (sizeof(*s->sort_info));
s->sort_info = (struct zset_sort_info *)
xmalloc (sizeof(*s->sort_info));
- s->sort_info->max_entries = 1000;
+ s->sort_info->max_entries = atoi(sort_max_str);
+ if (s->sort_info->max_entries < 2)
+ s->sort_info->max_entries = 2;
+
s->sort_info->entries = (struct zset_sort_entry **)
xmalloc (sizeof(*s->sort_info->entries) *
s->sort_info->max_entries);
s->sort_info->entries = (struct zset_sort_entry **)
xmalloc (sizeof(*s->sort_info->entries) *
s->sort_info->max_entries);
@@
-379,7
+384,7
@@
ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name,
{
int position = 0;
int num_i = 0;
{
int position = 0;
int num_i = 0;
- int psysno = 0;
+ zint psysno = 0;
int term_index;
RSFD rfd;
struct it_key key;
int term_index;
RSFD rfd;
struct it_key key;
@@
-391,9
+396,14
@@
ZebraPosSet zebraPosSetCreate (ZebraHandle zh, const char *name,
rfd = rset_open (rset, RSETF_READ);
while (num_i < num && rset_read (rset, rfd, &key, &term_index))
{
rfd = rset_open (rset, RSETF_READ);
while (num_i < num && rset_read (rset, rfd, &key, &term_index))
{
- if (key.sysno != psysno)
+#if IT_KEY_NEW
+ zint this_sys = key.mem[0];
+#else
+ zint this_sys = key.sysno;
+#endif
+ if (this_sys != psysno)
{
{
- psysno = key.sysno;
+ psysno = this_sys;
if (sort_info)
{
/* determine we alreay have this in our set */
if (sort_info)
{
/* determine we alreay have this in our set */
@@
-433,7
+443,7
@@
struct sortKeyInfo {
void resultSetInsertSort (ZebraHandle zh, ZebraSet sset,
struct sortKeyInfo *criteria, int num_criteria,
void resultSetInsertSort (ZebraHandle zh, ZebraSet sset,
struct sortKeyInfo *criteria, int num_criteria,
- int sysno)
+ zint sysno)
{
struct zset_sort_entry this_entry;
struct zset_sort_entry *new_entry = NULL;
{
struct zset_sort_entry this_entry;
struct zset_sort_entry *new_entry = NULL;
@@
-507,7
+517,7
@@
void resultSetInsertSort (ZebraHandle zh, ZebraSet sset,
}
void resultSetInsertRank (ZebraHandle zh, struct zset_sort_info *sort_info,
}
void resultSetInsertRank (ZebraHandle zh, struct zset_sort_info *sort_info,
- int sysno, int score, int relation)
+ zint sysno, int score, int relation)
{
struct zset_sort_entry *new_entry = NULL;
int i, j;
{
struct zset_sort_entry *new_entry = NULL;
int i, j;
@@
-598,7
+608,8
@@
void resultSetSortSingle (ZebraHandle zh, NMEM nmem,
ZebraSet sset, RSET rset,
Z_SortKeySpecList *sort_sequence, int *sort_status)
{
ZebraSet sset, RSET rset,
Z_SortKeySpecList *sort_sequence, int *sort_status)
{
- int i, psysno = 0;
+ int i;
+ zint psysno = 0;
struct it_key key;
struct sortKeyInfo sort_criteria[3];
int num_criteria;
struct it_key key;
struct sortKeyInfo sort_criteria[3];
int num_criteria;
@@
-670,10
+681,15
@@
void resultSetSortSingle (ZebraHandle zh, NMEM nmem,
rfd = rset_open (rset, RSETF_READ);
while (rset_read (rset, rfd, &key, &term_index))
{
rfd = rset_open (rset, RSETF_READ);
while (rset_read (rset, rfd, &key, &term_index))
{
- if (key.sysno != psysno)
+#if IT_KEY_NEW
+ zint this_sys = key.mem[0];
+#else
+ zint this_sys = key.sysno;
+#endif
+ if (this_sys != psysno)
{
(sset->hits)++;
{
(sset->hits)++;
- psysno = key.sysno;
+ psysno = this_sys;
resultSetInsertSort (zh, sset,
sort_criteria, num_criteria, psysno);
}
resultSetInsertSort (zh, sset,
sort_criteria, num_criteria, psysno);
}
@@
-709,6
+725,7
@@
void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset)
ZebraRankClass rank_class;
struct rank_control *rc;
struct zset_sort_info *sort_info;
ZebraRankClass rank_class;
struct rank_control *rc;
struct zset_sort_info *sort_info;
+ const char *rank_handler_name = res_get_def(zh->res, "rank", "rank-1");
sort_info = zebraSet->sort_info;
sort_info->num_entries = 0;
sort_info = zebraSet->sort_info;
sort_info->num_entries = 0;
@@
-717,28
+734,42
@@
void resultSetRank (ZebraHandle zh, ZebraSet zebraSet, RSET rset)
yaz_log (LOG_LOG, "resultSetRank");
yaz_log (LOG_LOG, "resultSetRank");
- rank_class = zebraRankLookup (zh, res_get_def(zh->res, "rank", "rank-1"));
+ rank_class = zebraRankLookup (zh, rank_handler_name);
+ if (!rank_class)
+ {
+ yaz_log (LOG_WARN, "No such rank handler: %s", rank_handler_name);
+ return;
+ }
rc = rank_class->control;
if (rset_read (rset, rfd, &key, &term_index))
{
rc = rank_class->control;
if (rset_read (rset, rfd, &key, &term_index))
{
- int psysno = key.sysno;
+#if IT_KEY_NEW
+ zint psysno = key.mem[0];
+#else
+ zint psysno = key.sysno;
+#endif
int score;
void *handle =
(*rc->begin) (zh->reg, rank_class->class_handle, rset);
(zebraSet->hits)++;
do
{
int score;
void *handle =
(*rc->begin) (zh->reg, rank_class->class_handle, rset);
(zebraSet->hits)++;
do
{
+#if IT_KEY_NEW
+ zint this_sys = key.mem[0];
+#else
+ zint this_sys = key.sysno;
+#endif
kno++;
kno++;
- if (key.sysno != psysno)
+ if (this_sys != psysno)
{
score = (*rc->calc) (handle, psysno);
resultSetInsertRank (zh, sort_info, psysno, score, 'A');
(zebraSet->hits)++;
{
score = (*rc->calc) (handle, psysno);
resultSetInsertRank (zh, sort_info, psysno, score, 'A');
(zebraSet->hits)++;
- psysno = key.sysno;
+ psysno = this_sys;
}
}
- (*rc->add) (handle, key.seqno, term_index);
+ (*rc->add) (handle, this_sys, term_index);
}
while (rset_read (rset, rfd, &key, &term_index));
score = (*rc->calc) (handle, psysno);
}
while (rset_read (rset, rfd, &key, &term_index));
score = (*rc->calc) (handle, psysno);