X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Freclists.c;h=738fdc481621d340533d4abc3949ec8d394840aa;hb=b4e80d145253134b44614896ba7f0b1975d22afa;hp=783025fd4cfabe6c5dab8b3ad6886c8eeff0cb35;hpb=9e625af75632d86876dc419d0140e51bdef98d7e;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index 783025f..738fdc4 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -1,4 +1,4 @@ -/* $Id: reclists.c,v 1.20 2007-07-23 12:23:30 adam Exp $ +/* $Id: reclists.c,v 1.23 2007-09-10 16:25:50 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -110,7 +110,7 @@ struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms) const char *cpp; int increasing; int i; - int offset; + int offset = 0; enum conf_sortkey_type type; struct reclist_sortparms *new; @@ -129,7 +129,6 @@ struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms) if (!strcmp(parm, "relevance")) { type = Metadata_sortkey_relevance; - offset = -1; } else { @@ -177,14 +176,14 @@ static int reclist_cmp(const void *p1, const void *p2) union data_types *ut2 = r2->sortkeys[s->offset]; switch (s->type) { - char *s1, *s2; + const char *s1, *s2; case Metadata_sortkey_relevance: res = r2->relevance - r1->relevance; break; case Metadata_sortkey_string: - s1 = ut1 ? ut1->text : ""; - s2 = ut2 ? ut2->text : ""; + s1 = ut1 ? ut1->text.sort : ""; + s2 = ut2 ? ut2->text.sort : ""; res = strcmp(s2, s1); if (res) { @@ -208,8 +207,8 @@ static int reclist_cmp(const void *p1, const void *p2) res = 0; break; default: - yaz_log(YLOG_FATAL, "Bad sort type: %d", s->type); - exit(1); + yaz_log(YLOG_WARN, "Bad sort type: %d", s->type); + res = 0; } } return res;