+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
-
-<server>
- <listen port="9004"/>
- <proxy host="localhost" port="80"/>
-
- <service>
- <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6"/>
- <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"/>
- <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2"/>
- <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
- </service>
-</server>
-
-<!-- Need to figure out where to get ZeeRex records for targets from -->
-
-<queryprofile/> <!-- Like a CCL profile++ . Can optionally refer to XSLT to
- convert ZeeRex into queryprofile. Multiple profiles can exist. -->
-
-<retrievalprofile>
- <requestsyntax>marc21</requestsyntax>
- <nativesyntax name="iso2709" format="marc21" encoding="marc-8" mapto="marcxml"/>
- <map type="xslt" stylesheet="marc21.xsl"/>
-</retrievalprofile>
-
-</pazpar2>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<pazpar2 xmlns="http://www.indexdata.com/pazpar2/1.0">
+
+<server>
+ <listen port="9004"/>
+ <proxy host="us1.indexdata.com"/>
+
+ <service>
+ <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6"/>
+ <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range"/>
+ <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2"/>
+ <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
+ </service>
+</server>
+
+<!-- Need to figure out where to get ZeeRex records for targets from -->
+
+<queryprofile/> <!-- Like a CCL profile++ . Can optionally refer to XSLT to
+ convert ZeeRex into queryprofile. Multiple profiles can exist. -->
+
+<retrievalprofile>
+ <requestsyntax>marc21</requestsyntax>
+ <nativesyntax name="iso2709" format="marc21" encoding="marc-8" mapto="marcxml"/>
+ <map type="xslt" stylesheet="marc21.xsl"/>
+</retrievalprofile>
+
+</pazpar2>
int brief; // Is this element to be returned in the brief format?
int termlist;// Is this field to be treated as a termlist for browsing?
int rank; // Rank factor. 0 means don't use this field for ranking, 1 is default
+ // values >1 give additional significance to a field
enum
{
Metadata_type_generic, // Generic text field
Metadata_sortkey_no, // This is not to be used as a sortkey
Metadata_sortkey_numeric, // Standard numerical sorting
Metadata_sortkey_range, // Range sorting (pick lowest or highest)
- Metadata_sortkey_skiparticle // Skip leading article when sorting
+ Metadata_sortkey_skiparticle, // Skip leading article when sorting
+ Metadata_sortkey_string
} sortkey;
enum
{
/*
- * $Id: http_command.c,v 1.17 2007-01-11 10:03:01 sondberg Exp $
+ * $Id: http_command.c,v 1.18 2007-01-11 17:14:06 quinn Exp $
*/
#include <stdio.h>
#include <yaz/yaz-util.h>
+#include "config.h"
#include "util.h"
#include "eventl.h"
#include "pazpar2.h"
http_send_response(c);
}
+static void cmd_info(struct http_channel *c)
+{
+ struct http_request *rq = c->request;
+ struct http_response *rs = c->response;
+ struct http_session *s = locate_session(rq, rs);
+
+ if (!s)
+ return;
+}
struct {
char *name;
{ "exit", cmd_exit },
{ "ping", cmd_ping },
{ "record", cmd_record },
+ { "info", cmd_info },
{0,0}
};
-/* $Id: pazpar2.c,v 1.26 2007-01-10 11:56:10 adam Exp $ */
+/* $Id: pazpar2.c,v 1.27 2007-01-11 17:14:06 quinn Exp $ */
#include <stdlib.h>
#include <stdio.h>
// Note: Some things in this structure will eventually move to configuration
struct parameters global_parameters =
{
+ "",
+ "",
0,
0,
30,
return res;
}
+static void start_http_listener(void)
+{
+ char hp[128] = "";
+ struct conf_server *ser = global_parameters.server;
+
+ if (*global_parameters.listener_override)
+ strcpy(hp, global_parameters.listener_override);
+ else
+ {
+ strcpy(hp, ser->host ? ser->host : "");
+ if (ser->port)
+ {
+ if (*hp)
+ strcat(hp, ":");
+ sprintf(hp + strlen(hp), "%d", ser->port);
+ }
+ }
+ http_init(hp);
+}
+
+static void start_proxy(void)
+{
+ char hp[128] = "";
+ struct conf_server *ser = global_parameters.server;
+
+ if (*global_parameters.proxy_override)
+ strcpy(hp, global_parameters.proxy_override);
+ else if (ser->proxy_host || ser->proxy_port)
+ {
+ strcpy(hp, ser->proxy_host ? ser->proxy_host : "");
+ if (ser->proxy_port)
+ {
+ if (*hp)
+ strcat(hp, ":");
+ sprintf(hp + strlen(hp), "%d", ser->proxy_port);
+ }
+ }
+ else
+ return;
+
+ http_set_proxyaddr(hp);
+}
+
int main(int argc, char **argv)
{
int ret;
char *arg;
- int setport = 0;
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
yaz_log(YLOG_WARN|YLOG_ERRNO, "signal");
exit(1);
break;
case 'h':
- http_init(arg);
- setport++;
+ strcpy(global_parameters.listener_override, arg);
break;
case 'C':
global_parameters.ccl_filter = load_cclfile(arg);
break;
case 'p':
- http_set_proxyaddr(arg);
+ strcpy(global_parameters.proxy_override, arg);
break;
case 's':
load_simpletargets(arg);
}
global_parameters.server = config->servers;
- if (!setport)
- {
- fprintf(stderr, "Set command port with -h\n");
- exit(1);
- }
-
+ start_http_listener();
+ start_proxy();
global_parameters.ccl_filter = load_cclfile("../etc/default.bib");
global_parameters.yaz_marc = yaz_marc_create();
yaz_marc_subfield_str(global_parameters.yaz_marc, "\t");
};
struct parameters {
+ char proxy_override[128];
+ char listener_override[128];
struct conf_server *server;
int dump_records;
int timeout; /* operations timeout, in seconds */