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
Sort by retrieval PAZ-1006
[pazpar2-moved-to-github.git]
/
src
/
reclists.c
diff --git
a/src/reclists.c
b/src/reclists.c
index
103eefd
..
245d061
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,6
+123,10
@@
struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
{
type = Metadata_type_position;
}
{
type = Metadata_type_position;
}
+ else if (!strcmp(parm, "retrieval"))
+ {
+ type = Metadata_type_retrieval;
+ }
else
{
for (i = 0; i < service->num_sortkeys; i++)
else
{
for (i = 0; i < service->num_sortkeys; i++)
@@
-234,6
+238,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,22
+337,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)
{
}
void reclist_rewind(struct reclist *l)
{
- if (l)
- l->sorted_ptr = l->sorted_list;
+ l->sorted_ptr = l->sorted_list;
}
}
@@
-444,6
+448,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);