SYNOPSIS#include "napi.h"
void n_synchronous(SERVER *se)
void n_asynchronous(SERVER *se)
DESCRIPTION
PLEASE NOTE: As of this release the program will always operate in
the synchronous
mode, but please feel free to embed calls to these
functions within your program because they will not affect program
operation once we do enable this feature.
These functions tell the referenced server whether to wait for the clients handshake response from a callback function or run ahead of the client and queue up all of the results. If the server is Metamorph, the meaning of these operations would be as follows:
Synchronous mode (sync):
1: Client issues a query
2: Server locates first hit
3: Server calls client callback function()
3a: if client returns FALSE then server aborts query
3b: if client returns TRUE then server finds next hit
and performs step 3 again
Asynchronous mode (async):
1: Client issues a query
2: Server begins locating hits and starts enqueuing client callbacks
3: Client responds to servers callbacks
3a: if client returns FALSE then server aborts current query
At first glance async mode would seem to be the way to go, but there is a hitch! The server may have enqueued quite a few callback requests in the output buffer, and the client will have to respond to them. So if the hapless user did a query for the word: "the", not only are the network and client bogged down with a whole lot of silly callbacks, but the server has also wasted a whole bunch of crunch power.
So why use async mode? Well, if the user had a very legitimate query and actually wanted all of its results, then async provides the fastest response possible. This is because the server is probably locating new hits faster than the user at the client end can look at them. Our advice for interactive applications is to always begin the interaction with the server in sync mode, and allow the user the option to place it in async mode after they have viewed a hit or two. This gives the user the ability to change their mind about the query and either add or delete elements from it in addition to being quite computationally prudent. By the way, this whole process is known as Relevance Feedback to those people in the Text Retrieval buzzword business.
CAVEATS
already given
SEE ALSO
The Metamorph User Interface