projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updates to pz:authentication documentation
[pazpar2-moved-to-github.git]
/
src
/
reclists.c
diff --git
a/src/reclists.c
b/src/reclists.c
index
817c133
..
e96ee92
100644
(file)
--- a/
src/reclists.c
+++ b/
src/reclists.c
@@
-1,5
+1,5
@@
/* This file is part of Pazpar2.
/* This file is part of Pazpar2.
- Copyright (C) 2006-2013 Index Data
+ Copyright (C) Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-123,7
+123,11
@@
struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
{
type = Metadata_type_position;
}
{
type = Metadata_type_position;
}
- else
+ else if (!strcmp(parm, "retrieval"))
+ {
+ type = Metadata_type_retrieval;
+ }
+ else if (service)
{
for (i = 0; i < service->num_sortkeys; i++)
{
{
for (i = 0; i < service->num_sortkeys; i++)
{
@@
-142,6
+146,12
@@
struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
}
offset = i;
}
}
offset = i;
}
+ else
+ {
+ yaz_log(YLOG_FATAL, "Sortkey not defined in service: %s",
+ parm);
+ return 0;
+ }
}
new = *rp = nmem_malloc(nmem, sizeof(struct reclist_sortparms));
new->next = 0;
}
new = *rp = nmem_malloc(nmem, sizeof(struct reclist_sortparms));
new->next = 0;
@@
-234,6
+244,9
@@
static int reclist_cmp(const void *p1, const void *p2)
else
res = 0;
break;
else
res = 0;
break;
+ case Metadata_type_retrieval:
+ res = r1->retrieval_position - r2->retrieval_position;
+ break;
}
if (res && !s->increasing)
res *= -1;
}
if (res && !s->increasing)
res *= -1;
@@
-330,16
+343,19
@@
struct record_cluster *reclist_read_record(struct reclist *l)
void reclist_enter(struct reclist *l)
{
yaz_mutex_enter(l->mutex);
void reclist_enter(struct reclist *l)
{
yaz_mutex_enter(l->mutex);
- if (l)
- l->sorted_ptr = l->sorted_list;
+ l->sorted_ptr = l->sorted_list;
}
void reclist_leave(struct reclist *l)
{
yaz_mutex_leave(l->mutex);
}
void reclist_leave(struct reclist *l)
{
yaz_mutex_leave(l->mutex);
- if (l)
- l->sorted_ptr = l->sorted_list;
+ l->sorted_ptr = l->sorted_list;
+}
+
+void reclist_rewind(struct reclist *l)
+{
+ l->sorted_ptr = l->sorted_list;
}
}
@@
-438,6
+454,7
@@
static struct record_cluster *new_cluster(
cluster = nmem_malloc(l->nmem, sizeof(*cluster));
record->next = 0;
cluster = nmem_malloc(l->nmem, sizeof(*cluster));
record->next = 0;
+ cluster->retrieval_position = l->num_records;
cluster->records = record;
cluster->merge_keys = 0;
append_merge_keys(&cluster->merge_keys, merge_keys, l->nmem);
cluster->records = record;
cluster->merge_keys = 0;
append_merge_keys(&cluster->merge_keys, merge_keys, l->nmem);