1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2011 Index Data
4 Zebra 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 Zebra 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
23 static void tst(int argc, char **argv)
26 char profile_path[256];
27 char record_buf[20000];
28 const char *records_array[] = {
34 ZebraService zs = tl_start_up(0, argc, argv);
35 ZebraHandle zh = zebra_open(zs, 0);
37 tl_check_filter(zs, "alvis");
39 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
43 sprintf(profile_path, "%s:%s/../../tab",
44 tl_get_srcdir(), tl_get_srcdir());
45 zebra_set_resource(zh, "profilePath", profile_path);
47 zebra_set_resource(zh, "recordType", "alvis.marcschema-col.xml");
49 sprintf(path, "%.200s/marc-col.xml", tl_get_srcdir());
50 f = fopen(path, "rb");
53 yaz_log(YLOG_FATAL|YLOG_ERRNO, "Cannot open %s", path);
56 r = fread(record_buf, 1, sizeof(record_buf)-1, f);
57 if (r < 2 || r == sizeof(record_buf)-1)
59 yaz_log(YLOG_FATAL, "Bad size of %s", path);
66 /* for now only the first of the records in the collection is
67 indexed. That can be seen as a bug */
68 YAZ_CHECK(tl_init_data(zh, records_array));
70 /* only get hits from first record .. */
71 YAZ_CHECK(tl_query(zh, "@attr 1=title computer", 3));
72 YAZ_CHECK(tl_query(zh, "@attr 1=control 11224466", 1));
73 YAZ_CHECK(tl_query_x(zh, "@attr 1=titl computer", 0, 114));
75 YAZ_CHECK(tl_close_down(zh, zs));
82 * c-file-style: "Stroustrup"
83 * indent-tabs-mode: nil
85 * vim: shiftwidth=4 tabstop=8 expandtab