-/* $Id: pazpar2.c,v 1.12 2007-01-04 07:38:36 adam Exp $ */;
+/* $Id: pazpar2.c,v 1.18 2007-01-08 12:43:41 adam Exp $ */;
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
+#include <yaz/marcdisp.h>
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/proto.h>
#include <yaz/yaz-util.h>
#include <yaz/nmem.h>
+#if HAVE_CONFIG_H
+#include "cconfig.h"
+#endif
+
#define USE_TIMING 0
#if USE_TIMING
#include <yaz/timing.h>
#include "pazpar2.h"
#include "eventl.h"
-#include "command.h"
#include "http.h"
#include "termlists.h"
#include "reclists.h"
#include "relevance.h"
#include "config.h"
-#define PAZPAR2_VERSION "0.1"
#define MAX_CHUNK 15
static void client_fatal(struct client *cl);
30,
"81",
"Index Data PazPar2 (MasterKey)",
- PAZPAR2_VERSION,
+ VERSION,
600, // 10 minutes
60,
100,
int start = cl->records + 1;
toget = global_parameters.chunk;
+ if (toget > global_parameters.toget - cl->records)
+ toget = global_parameters.toget - cl->records;
if (toget > cl->hits - cl->records)
toget = cl->hits - cl->records;
if (!(mergekey = xmlGetProp(root, "mergekey")))
{
yaz_log(YLOG_WARN, "No mergekey found in record");
+ xmlFreeDoc(xdoc);
return 0;
}
res->merge_key = normalize_mergekey(mergekey_norm);
head = reclist_insert(se->reclist, res);
+ if (!head)
+ {
+ /* no room for record */
+ xmlFreeDoc(xdoc);
+ return 0;
+ }
relevance_newrec(se->relevance, head);
for (n = root->children; n; n = n->next)
}
else if (!strcmp(n->name, "metadata"))
{
- xmlChar *type = xmlGetProp(n, "type"), *value;
+ xmlChar *type = xmlGetProp(n, "type");
if (type && !strcmp(type, "title"))
{
xmlChar *value = xmlNodeListGetString(xdoc, n->children, 0);
return 0;
}
-#ifdef REPORT_NMEM
-// conditional compilation by SH: This lead to a warning with currently installed
-// YAZ header files on us1
+#ifdef MISSING_HEADERS
void report_nmem_stats(void)
{
size_t in_use, is_free;
yaz_log_init(YLOG_DEFAULT_LEVEL, "pazpar2", 0);
- while ((ret = options("f:x:c:h:p:C:s:d", argv, argc, &arg)) != -2)
+ while ((ret = options("f:x:h:p:C:s:d", argv, argc, &arg)) != -2)
{
switch (ret) {
case 'f':
if (!read_config(arg))
exit(1);
break;
- case 'c':
- command_init(atoi(arg));
- setport++;
- break;
case 'h':
http_init(arg);
setport++;
fprintf(stderr, "Usage: pazpar2\n"
" -f configfile\n"
" -h [host:]port (REST protocol listener)\n"
- " -c cmdport (telnet-style)\n"
" -C cclconfig\n"
" -s simpletargetfile\n"
" -p hostname[:portno] (HTTP proxy)\n");
if (!setport)
{
- fprintf(stderr, "Set command port with -h or -c\n");
+ fprintf(stderr, "Set command port with -h\n");
exit(1);
}