1 /* $Id: test_reclists.c,v 1.1 2007-04-25 13:09:17 marc Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 #include <yaz/timing.h>
39 void test_reclist_sortparms(int argc, char **argv)
41 NMEM nmem = nmem_create();
43 struct conf_service *service = 0;
44 service = conf_service_create(nmem, 1, 2);
46 conf_service_add_metadata(nmem, service, 0, "title",
47 Metadata_type_generic, Metadata_merge_unique,
50 conf_service_add_sortkey(nmem, service, 0, "relevance",
51 Metadata_sortkey_relevance);
53 conf_service_add_sortkey(nmem, service, 1, "title",
54 Metadata_sortkey_string);
57 // initializing of sort parameters is controlled by service descriptions
58 struct reclist_sortparms *sort_parms = 0;
60 // sorting ascending according to relevance, then title
61 YAZ_CHECK(0 == sort_parms);
62 YAZ_CHECK(reclist_sortparms_insert(nmem, &sort_parms, service, "title", 1));
63 YAZ_CHECK(sort_parms);
65 YAZ_CHECK(0 == sort_parms->next);
66 YAZ_CHECK(reclist_sortparms_insert(nmem, &sort_parms, service,
68 YAZ_CHECK(sort_parms->next);
78 int main(int argc, char **argv)
80 YAZ_CHECK_INIT(argc, argv);
84 test_reclist_sortparms(argc, argv);
96 * indent-tabs-mode: nil
98 * vim: shiftwidth=4 tabstop=8 expandtab