projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the scope parameter to rsets, and using it in all forwards and reads
[idzebra-moved-to-github.git]
/
index
/
zserver.c
diff --git
a/index/zserver.c
b/index/zserver.c
index
b0f2be7
..
996c31e
100644
(file)
--- a/
index/zserver.c
+++ b/
index/zserver.c
@@
-1,4
+1,4
@@
-/* $Id: zserver.c,v 1.113 2004-01-22 11:27:21 adam Exp $
+/* $Id: zserver.c,v 1.122 2004-08-25 09:28:01 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
@@
-79,6
+79,7
@@
bend_initresult *bend_init (bend_initrequest *q)
r->errcode = 1;
return r;
}
r->errcode = 1;
return r;
}
+ r->handle = zh;
if (q->auth)
{
if (q->auth->which == Z_IdAuthentication_open)
if (q->auth)
{
if (q->auth->which == Z_IdAuthentication_open)
@@
-93,15
+94,20
@@
bend_initresult *bend_init (bend_initrequest *q)
}
xfree (openpass);
}
}
xfree (openpass);
}
+ else if (q->auth->which == Z_IdAuthentication_idPass)
+ {
+ Z_IdPass *idPass = q->auth->u.idPass;
+
+ user = idPass->userId;
+ passwd = idPass->password;
+ }
}
if (zebra_auth (zh, user, passwd))
{
r->errcode = 222;
r->errstring = user;
}
if (zebra_auth (zh, user, passwd))
{
r->errcode = 222;
r->errstring = user;
- zebra_close (zh);
return r;
}
return r;
}
- r->handle = zh;
if (q->charneg_request) /* characater set and langauge negotiation? */
{
char **charsets = 0;
if (q->charneg_request) /* characater set and langauge negotiation? */
{
char **charsets = 0;
@@
-164,15
+170,16
@@
bend_initresult *bend_init (bend_initrequest *q)
static void search_terms (ZebraHandle zh, bend_search_rr *r)
{
static void search_terms (ZebraHandle zh, bend_search_rr *r)
{
- int count;
+ zint count = 0;
int no_terms;
int i;
int no_terms;
int i;
- int type;
+ int type = Z_Term_general;
struct Z_External *ext;
Z_SearchInfoReport *sr;
/* get no of terms for result set */
struct Z_External *ext;
Z_SearchInfoReport *sr;
/* get no of terms for result set */
- no_terms = zebra_resultSetTerms (zh, r->setname, 0, 0, 0, 0, 0);
+ no_terms = 0; /* zebra_resultSetTerms (zh, r->setname, 0, 0, 0, 0, 0); */
+ /* FIXME - Rsets don't know number of terms no more ??? */
if (!no_terms)
return;
if (!no_terms)
return;
@@
-202,9
+209,11
@@
static void search_terms (ZebraHandle zh, bend_search_rr *r)
Z_Term *term;
char outbuf[1024];
size_t len = sizeof(outbuf);
Z_Term *term;
char outbuf[1024];
size_t len = sizeof(outbuf);
+ /* FIXME - Can we just skip this ??? */
+ /*
zebra_resultSetTerms (zh, r->setname, i,
&count, &type, outbuf, &len);
zebra_resultSetTerms (zh, r->setname, i,
&count, &type, outbuf, &len);
-
+ */
sr->elements[i] = odr_malloc (r->stream, sizeof(**sr->elements));
sr->elements[i]->subqueryId = 0;
sr->elements[i]->fullQuery = odr_malloc (r->stream,
sr->elements[i] = odr_malloc (r->stream, sizeof(**sr->elements));
sr->elements[i]->subqueryId = 0;
sr->elements[i]->fullQuery = odr_malloc (r->stream,
@@
-240,7
+249,9
@@
static void search_terms (ZebraHandle zh, bend_search_rr *r)
sr->elements[i]->subqueryExpression->u.term->termComment = 0;
sr->elements[i]->subqueryInterpretation = 0;
sr->elements[i]->subqueryRecommendation = 0;
sr->elements[i]->subqueryExpression->u.term->termComment = 0;
sr->elements[i]->subqueryInterpretation = 0;
sr->elements[i]->subqueryRecommendation = 0;
- sr->elements[i]->subqueryCount = odr_intdup (r->stream, count);
+ if (count > 2000000000)
+ count = 2000000000;
+ sr->elements[i]->subqueryCount = odr_intdup (r->stream, (int) count);
sr->elements[i]->subqueryWeight = 0;
sr->elements[i]->resultsByDB = 0;
}
sr->elements[i]->subqueryWeight = 0;
sr->elements[i]->resultsByDB = 0;
}
@@
-323,6
+334,11
@@
static int bend_scan (void *handle, bend_scan_rr *r)
zebra_result (zh, &r->errcode, &r->errstring);
return 0;
}
zebra_result (zh, &r->errcode, &r->errstring);
return 0;
}
+ if (r->step_size != 0 && *r->step_size != 0) {
+ r->errcode = 205; /* "Only zero step size supported for Scan" */
+ r->errstring = 0;
+ return 0;
+ }
r->entries = (struct scan_entry *)
odr_malloc (r->stream, sizeof(*r->entries) * r->num_entries);
zebra_scan (zh, r->stream, r->term,
r->entries = (struct scan_entry *)
odr_malloc (r->stream, sizeof(*r->entries) * r->num_entries);
zebra_scan (zh, r->stream, r->term,
@@
-372,6
+388,10
@@
int bend_delete (void *handle, bend_delete_rr *rr)
static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r)
{
static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r)
{
+ if (r->toKeep->databaseName)
+ {
+ yaz_log(LOG_LOG, "adm request database %s", r->toKeep->databaseName);
+ }
switch (r->toKeep->which)
{
case Z_ESAdminOriginPartToKeep_reIndex:
switch (r->toKeep->which)
{
case Z_ESAdminOriginPartToKeep_reIndex:
@@
-398,6
+418,9
@@
static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r)
break;
case Z_ESAdminOriginPartToKeep_commit:
yaz_log(LOG_LOG, "adm-commit");
break;
case Z_ESAdminOriginPartToKeep_commit:
yaz_log(LOG_LOG, "adm-commit");
+ if (r->toKeep->databaseName)
+ zebra_select_database(zh, r->toKeep->databaseName);
+ zebra_commit(zh);
break;
case Z_ESAdminOriginPartToKeep_shutdown:
yaz_log(LOG_LOG, "shutdown");
break;
case Z_ESAdminOriginPartToKeep_shutdown:
yaz_log(LOG_LOG, "shutdown");
@@
-410,10
+433,6
@@
static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r)
default:
yaz_log(LOG_LOG, "unknown admin");
}
default:
yaz_log(LOG_LOG, "unknown admin");
}
- if (r->toKeep->databaseName)
- {
- yaz_log(LOG_LOG, "database %s", r->toKeep->databaseName);
- }
return 0;
}
return 0;
}
@@
-528,7
+547,7
@@
int bend_esrequest (void *handle, bend_esrequest_rr *rr)
Z_External *rec = notToKeep->elements[i]->record;
struct oident *oident = 0;
Odr_oct *opaque_recid = 0;
Z_External *rec = notToKeep->elements[i]->record;
struct oident *oident = 0;
Odr_oct *opaque_recid = 0;
- int sysno = 0;
+ SYSNO sysno = 0;
if (notToKeep->elements[i]->u.opaque)
{
if (notToKeep->elements[i]->u.opaque)
{
@@
-627,7
+646,8
@@
int bend_esrequest (void *handle, bend_esrequest_rr *rr)
0, /* match */
0, /* fname */
rec->u.octet_aligned->buf,
0, /* match */
0, /* fname */
rec->u.octet_aligned->buf,
- rec->u.octet_aligned->len);
+ rec->u.octet_aligned->len,
+ 0);
if (r)
{
rr->errcode = 224;
if (r)
{
rr->errcode = 224;
@@
-689,7
+709,7
@@
static void bend_start (struct statserv_options_block *sob)
{
if (sob->handle)
zebra_stop((ZebraService) sob->handle);
{
if (sob->handle)
zebra_stop((ZebraService) sob->handle);
- sob->handle = zebra_start(sob->configname, 0, 0);
+ sob->handle = zebra_start(sob->configname);
if (!sob->handle)
{
yaz_log (LOG_FATAL, "Failed to read config `%s'", sob->configname);
if (!sob->handle)
{
yaz_log (LOG_FATAL, "Failed to read config `%s'", sob->configname);