An alert reader wrote:
> What is the proper format for defining multiple databases to be
> searched in the gateway.ini file? I have (at the moment) two
> databases, one named MAR and the other SBAL. I've tried
>
> location=MAR+Test Database 1,localhost:210/SBAL+Test Database2,localhost:210
There are a couple of ways to make this happen. zgate will paste the appropriate HTML into the SELECT block in place of the $databases$ variable (you'll see it in numsearch.html). In order for zgate to paste it in, it needs to read the list from the location variable in gateway.ini - the correct form for this case is simply:
[sites]
location=MAR+Test Database 1,SBAL+Test Database 2
That is, the name of the database, followed by the descriptive text to appear in the selection box. The associated HTML is almost as Erik Guss points out:
<OPTION VALUE="your.host.name:210/SBAL"> Test Database 2would be correct except that, if SBAL and MAR are local to your machine, you will want to put this instead:
<OPTION VALUE="SBAL"> Test Database 2That's not quite all. The reason has to do with implementation. Let's consider searching your server using zclient first, then we'll generalize it to the zgate/zcon gateway.
If you have more than one database on your local machine, and if you want to query them both at the same time, you will need to run a second instance of zserver. The two zservers have to run on successive port numbers - that is, if you run your server on port 5555, run a second instance on port 5556 (I put zserver and zserver.ini in another subdirectory in the distribution, and edit ServerPort in that version of zserver - just make the sure the path to sapi.ini is pointing to ./bin/sapi.ini).
Then, you can do the following:
zclient localhost 5555 db1+db2 water[1,4]and you'll get hits from both. It works remotely, too, but again, has to pass through your zserver to refer the query out:
bin/zclient -q localhost 5555 \will query both those remote databases (though, zclient only returns 10 hits - I'm workin' on that).
The truth comes out - to do this for local databases, zserver treats them as if they were remote. So
zclient localhost 5555 db1+db2 water[1,4]actually gets translated into
zclient localhost 5555 localhost:5556/db1+localhost:5556/db2 water[1,4]Now, you should be able to see why we don't want to explicitly give the localhost and port in the HTML - we end up trying to talk to ourselves. Actually, it seemed to me that it should work, at least when zserver is running in STANDALONE mode (and spawns a child process when it gets a connection), but it was easy to treat everything consistently. One of these days I might rework it, but it seems to work now, and I don't get the sense that it's a real high-demand item, compared to other things on my to-do list.
Archie Warnock (warnock@awcubed.com)
A/WWW Enterprises