1 /* This file is part of Pazpar2.
2 Copyright (C) 2006-2008 Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <yaz/timing.h>
32 #include "pazpar2_config.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);
80 int main(int argc, char **argv)
82 YAZ_CHECK_INIT(argc, argv);
86 //test_reclist_sortparms(argc, argv);
98 * indent-tabs-mode: nil
100 * vim: shiftwidth=4 tabstop=8 expandtab