This is a brief description of the wire protocol used by the remote backend. This should be up to date for protocol version 20, but hasn't been thoroughly checked yet:
Message 1:
Direction: Server->Client
Format: OM <protocol version> <document count> <average length>
Description: Identifies protocol version and sends basic statistics.
When: At connection setting up time.
Message 2:
Direction: Client->Server
Format: Q<serialised query string>
<options>
<weighting>
<R-set>
Description: The query, options, weighting formula and parameters, and R-set.
When: At prepare_match() time
Message 3:
Direction: Server->Client
Format: L<serialised local stats>
Description: The local database statistics
Message 4:
Direction: Client->Server
Format: G<serialised global stats>
M<first item> <max items>
Description: The global statistics for all databases are sent,
and the MSet requested.
When: At get_mset() time.
Message 5:
Direction: Server->Client
Format: O<first> <lower bound> <estimated> <upper bound> <max_possible> <max_attained>\
<#items> [<weight> <doc id> <collapse key value>]...\
[<term> <frequency> <weight>]...
Description: The returned MSet.
Message KeepAlive:
Direction: Client->Server
Format: K
Description: Dummy message to stop the connection timing out.
Message KeepAliveResponse
Direction: Server->Client
Format: OK
Description: Dummy message to stop the connection timing out.
Message TermlistRequest:
Direction: Client->Server
Format: T<docid>
Description: The docid of the document we wish to get the termlist for.
Message TermlistResponse:
Direction: Server->Client
Format: [<within document frequency of term> <term frequency> term]
...
Z
Message GetDocumentRequest:
Direction: Client->Server
Format: D<docid>
Descrption: The docid of the document we wish to get.
Message GetDocumentResponse:
Direction: Server->Client
Format: O<data from the document, encoded using encode_tname>
<value number> <value string, encoded using encode_tname>
...
Z