/*
* stat->num_hits = s->total_hits;
* stat->num_records = s->total_records;
- * $Id: http_command.c,v 1.3 2006-11-27 14:35:15 quinn Exp $
+ * $Id: http_command.c,v 1.4 2006-11-27 19:44:26 quinn Exp $
*/
#include <stdio.h>
char *num = http_argbyname(rq, "num");
int startn = 0;
int numn = 20;
+ int total;
+ int total_hits;
int i;
if (!s)
if (num)
numn = atoi(num);
- rl = show(s->psession, startn, &numn);
+ rl = show(s->psession, startn, &numn, &total, &total_hits);
wrbuf_rewind(c->wrbuf);
wrbuf_puts(c->wrbuf, "<show>\n<status>OK</status>\n");
+ wrbuf_printf(c->wrbuf, "<merged>%d</merged>\n", total);
+ wrbuf_printf(c->wrbuf, "<total>%d</total>\n", total_hits);
+ wrbuf_printf(c->wrbuf, "<start>%d</start>\n", startn);
+ wrbuf_printf(c->wrbuf, "<num>%d</num>\n", numn);
for (i = 0; i < numn; i++)
{
-/* $Id: pazpar2.c,v 1.6 2006-11-27 14:35:15 quinn Exp $ */;
+/* $Id: pazpar2.c,v 1.7 2006-11-27 19:44:26 quinn Exp $ */;
#include <stdlib.h>
#include <stdio.h>
assert(len < 1023);
memcpy(buf, subfield, len);
buf[len] = '\0';
- termlist_insert(s->termlist, buf);
+ if (*buf)
+ termlist_insert(s->termlist, buf);
}
}
}
return termlist_highscore(s->termlist, num);
}
-struct record **show(struct session *s, int start, int *num)
+struct record **show(struct session *s, int start, int *num, int *total, int *sumhits)
{
struct record **recs = nmem_malloc(s->nmem, *num * sizeof(struct record *));
int i;
- // FIXME -- skip initial records
-
relevance_prepare_read(s->relevance, s->reclist);
+
+ *total = s->reclist->num_records;
+ *sumhits = s->total_hits;
+
+ for (i = 0; i < start; i++)
+ if (!reclist_read_record(s->reclist))
+ {
+ *num = 0;
+ return 0;
+ }
+
for (i = 0; i < *num; i++)
{
struct record *r = reclist_read_record(s->reclist);
int load_targets(struct session *s, const char *fn);
void statistics(struct session *s, struct statistics *stat);
char *search(struct session *s, char *query);
-struct record **show(struct session *s, int start, int *num);
+struct record **show(struct session *s, int start, int *num, int *total, int *sumhits);
struct termlist_score **termlist(struct session *s, int *num);
#endif