-/* $Id: http_command.c,v 1.56 2007-07-03 11:21:48 adam Exp $
+/* $Id: http_command.c,v 1.57 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
*/
/*
- * $Id: http_command.c,v 1.56 2007-07-03 11:21:48 adam Exp $
+ * $Id: http_command.c,v 1.57 2007-07-16 17:01:46 adam Exp $
*/
#include <stdio.h>
const char *idstr = http_argbyname(rq, "id");
const char *offsetstr = http_argbyname(rq, "offset");
- int id;
-
if (!s)
return;
if (!idstr)
return;
}
wrbuf_rewind(c->wrbuf);
- id = atoi(idstr);
- if (!(rec = show_single(s->psession, id)))
+ if (!(rec = show_single(s->psession, idstr)))
{
error(rs, PAZPAR2_RECORD_MISSING, idstr);
return;
else
{
wrbuf_puts(c->wrbuf, "<record>\n");
- wrbuf_printf(c->wrbuf, "<recid>%d</recid>\n", rec->recid);
+ wrbuf_printf(c->wrbuf, "<recid>%s</recid>\n", rec->recid);
write_metadata(c->wrbuf, service, rec->metadata, 1);
for (r = rec->records; r; r = r->next)
write_subrecord(r, c->wrbuf, service, 1);
write_subrecord(p, c->wrbuf, service, 0); // subrecs w/o details
if (ccount > 1)
wrbuf_printf(c->wrbuf, "<count>%d</count>\n", ccount);
- wrbuf_printf(c->wrbuf, "<recid>%d</recid>\n", rec->recid);
+ wrbuf_printf(c->wrbuf, "<recid>%s</recid>\n", rec->recid);
wrbuf_puts(c->wrbuf, "</hit>\n");
}
-/* $Id: logic.c,v 1.53 2007-07-16 09:09:56 adam Exp $
+/* $Id: logic.c,v 1.54 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
}
#endif
-struct record_cluster *show_single(struct session *s, int id)
+struct record_cluster *show_single(struct session *s, const char *id)
{
struct record_cluster *r;
reclist_rewind(s->reclist);
while ((r = reclist_read_record(s->reclist)))
- if (r->recid == id)
+ if (!strcmp(r->recid, id))
return r;
return 0;
}
record, (char *) mergekey_norm,
&se->total_merged);
if (global_parameters.dump_records)
- yaz_log(YLOG_LOG, "Cluster id %d from %s (#%d)", cluster->recid,
+ yaz_log(YLOG_LOG, "Cluster id %s from %s (#%d)", cluster->recid,
client_get_database(cl)->database->url, record_no);
if (!cluster)
{
-/* $Id: pazpar2.h,v 1.44 2007-06-28 09:36:10 adam Exp $
+/* $Id: pazpar2.h,v 1.45 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
char *filter, const char **addinfo);
struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
int *num, int *total, int *sumhits, NMEM nmem_show);
-struct record_cluster *show_single(struct session *s, int id);
+struct record_cluster *show_single(struct session *s, const char *id);
struct termlist_score **termlist(struct session *s, const char *name, int *num);
int session_set_watch(struct session *s, int what, session_watchfun fun, void *data, struct http_channel *c);
int session_active_clients(struct session *s);
-/* $Id: reclists.c,v 1.18 2007-07-02 20:55:50 adam Exp $
+/* $Id: reclists.c,v 1.19 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct record_cluster *reclist_insert( struct reclist *l,
struct conf_service *service,
struct record *record,
- const char *merge_key, int *total)
+ char *merge_key, int *total)
{
unsigned int bucket;
struct reclist_bucket **p;
new->record = newc;
new->next = 0;
newc->records = record;
- newc->merge_key = (char *) merge_key;
+ newc->merge_key = merge_key;
newc->relevance = 0;
newc->term_frequency_vec = 0;
- newc->recid = (*total)++;
+ newc->recid = merge_key;
+ (*total)++;
newc->metadata = nmem_malloc(l->nmem,
sizeof(struct record_metadata*) * service->num_metadata);
memset(newc->metadata, 0,
-/* $Id: reclists.h,v 1.10 2007-04-25 13:09:17 marc Exp $
+/* $Id: reclists.h,v 1.11 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct record_cluster *reclist_insert( struct reclist *tl,
struct conf_service *service,
struct record *record,
- const char *merge_key, int *total);
+ char *merge_key, int *total);
void reclist_sort(struct reclist *l, struct reclist_sortparms *parms);
struct record_cluster *reclist_read_record(struct reclist *l);
void reclist_rewind(struct reclist *l);
-/* $Id: record.h,v 1.10 2007-06-13 21:29:04 adam Exp $
+/* $Id: record.h,v 1.11 2007-07-16 17:01:46 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
int relevance;
int *term_frequency_vec;
// Set-specific ID for this record
- int recid;
+ char *recid;
struct record *records;
};
<md-author>Jack Collins</md-author><location id="z3950.indexdata.com/marc" name="Local Test"></location>
<location id="z3950.indexdata.com/marc" name="Local Test"></location>
<count>2</count>
-<recid>0</recid>
+<recid>title how to program a computer author jack collins medium book</recid>
</hit>
<hit>
<md-title>The use of passwords for controlled access to computer resources</md-title>
<md-date>1977</md-date>
<md-author>Wood, Helen M</md-author><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>6</recid>
+<recid>title the use of passwords for controlled access to computer resources author wood helen m medium book</recid>
</hit>
<hit>
<md-title>A plan for community college computer development</md-title>
<md-date>1971</md-date>
<md-description>Cover title</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>8</recid>
+<recid>title a plan for community college computer development author medium book</recid>
</hit>
<hit>
<md-date>1971</md-date>
<md-author>Englund, Carl R</md-author>
<md-description>"Contract DOT-UT-10003."</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>7</recid>
+<recid>title washington metropolitan area rail computer feasibility study author englund carl r medium book</recid>
</hit>
<hit>
<md-title>The Computer Bible</md-title>
<md-date>1973-1980</md-date>
<md-description>Vols. 2, 8: Missoula, Mont. : Published by Scholars Press for Biblical Research Associates</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>2</recid>
+<recid>title the computer bible author medium book</recid>
</hit>
<hit>
<md-title>Computer science & technology</md-title>
<md-title-remainder>proceedings of a workshop held at the National Bureau of Standards, Gaithersburg, MD, June 3-4, 1976</md-title-remainder>
<md-date>1977</md-date><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>5</recid>
+<recid>title computer science technology author medium book</recid>
</hit>
<hit>
<md-date>1974</md-date>
<md-author>Mairs, John W</md-author>
<md-description>Scale of maps ca. 1:1,000,000</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>3</recid>
+<recid>title the puget sound region author mairs john w medium book</recid>
</hit>
<hit>
<md-title-remainder>the proceedings of a workshop</md-title-remainder>
<md-date>1974</md-date>
<md-description>Includes bibliographical references and index</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>1</recid>
+<recid>title computer processing of dynamic images from an anger scintillation camera author medium book</recid>
</hit>
<hit>
<md-title-remainder>proceedings of the workshop</md-title-remainder>
<md-date>1977</md-date>
<md-description>Includes bibliographical references and index</md-description><location id="z3950.indexdata.com/marc" name="Local Test"></location>
-<recid>4</recid>
+<recid>title reconstruction tomography in diagnostic radiology and nuclear medicine author medium book</recid>
</hit>
</show>
<record>
-<recid>0</recid>
+<recid>title how to program a computer author jack collins medium book</recid>
<md-title>How to program a computer</md-title>
<md-author>Jack Collins</md-author>
http://localhost:9763/search.pz2?session=1&command=search&query=computer
2
http://localhost:9763/search.pz2?session=1&command=show&start=0&number=1&block=1
-http://localhost:9763/search.pz2?session=1&command=record&id=0
-http://localhost:9763/search.pz2?session=1&command=record&id=0&offset=0
+http://localhost:9763/search.pz2?session=1&command=record&id=title+how+to+program+a+computer+author+jack+collins+medium+book
+http://localhost:9763/search.pz2?session=1&command=record&id=title+how+to+program+a+computer+author+jack+collins+medium+book&offset=0
/* A very simple client that shows a basic usage of the pz2.js
-** $Id: example_client.js,v 1.3 2007-07-16 09:39:56 adam Exp $
+** $Id: example_client.js,v 1.4 2007-07-16 17:01:46 adam Exp $
*/
// create a parameters array and pass it to the pz2's constructor
var curPage = 1;
var recPerPage = 20;
var totalRec = 0;
-var curDetRecId = -1;
+var curDetRecId = '';
var curDetRecData = null;
// wait until the DOM is ready
function onFormSubmitEventHandler()
{
curPage = 1;
- curDetRecId = -1;
+ curDetRecId = '';
totalRec = 0;
my_paz.search(document.search.query.value, recPerPage, 'relevance');
return false;
// detailed record drawing
function showDetails ( prefixRecId ) {
- var recId = Number(prefixRecId.replace('rec_', ''));
+ var recId = prefixRecId.replace('rec_', '');
// remove current detailed view if any
var detRecordDiv = document.getElementById('det_'+curDetRecId);
// if the same clicked do not redraw
if ( recId == curDetRecId ) {
- curDetRecId = -1;
+ curDetRecId = '';
return;
}
'"><table><tr><td><b>Ttle</b></td><td><b>:</b> '+data["md-title"] +
"</td></tr><tr><td><b>Date</b></td><td><b>:</b> " + data["md-date"] +
"</td></tr><tr><td><b>Author</b></td><td><b>:</b> " + data["md-author"] +
- '</td></tr><tr><td><b>URL</b></td><td><b>:</b> <a href="' + data["md-url"] + '">' + data["md-url"] + '</a>' +
+ '</td></tr><tr><td><b>URL</b></td><td><b>:</b> <a href="' + data["md-electronic-url"] + '">' + data["md-electronic-url"] + '</a>' +
"</td></tr><tr><td><b>Subject</b></td><td><b>:</b> " + data["md-subject"] +
"</td></tr><tr><td><b>Location</b></td><td><b>:</b> " + data["location"][0].name +
"</td></tr></table></div>";