/usr/share/doc/xapian-doc/remote_protocol.html is in xapian-doc 1.2.16-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | <?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.8.1: http://docutils.sourceforge.net/" />
<title>Remote Backend Protocol</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7056 2011-06-17 10:50:48Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math {
margin-left: 2em ;
margin-right: 2em }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="remote-backend-protocol">
<h1 class="title">Remote Backend Protocol</h1>
<p>This document describes <em>version 35.1</em> of the protocol used by Xapian's
remote backend. The major protocol version increased to 35 in Xapian
1.1.5, and the minor protocol version to 1 in Xapian 1.2.4. Clients and
servers must support matching major protocol versions and the client's
minor protocol version must be the same or lower. This means that for a
minor protocol version change, you can upgrade first servers and then
clients and everything should work during the upgrades.</p>
<p>The protocol assumes a reliable two-way connection across which
arbitrary data can be sent - this could be provided by a TCP socket for
example (as it is with xapian-tcpsrv), but any such connection could be
used. For example, you could used xapian-progsrv across an ssh
connection, or even a custom server across a suitable serial connection.</p>
<p>All messages start with a single byte identifying code. A message from
client to server has a <tt class="docutils literal">MSG_XXX</tt> identifying code, while a message
from server to client has a <tt class="docutils literal">REPLY_XXX</tt> identifying code (but note
that a reply might not actually be in response to a message -
REPLY_GREETING isn't - and some messages result in multiple replies).</p>
<p>The identifying code is followed by the encoded length of the contents
followed by the contents themselves.</p>
<p>Inside the contents, strings are generally passed as an encoded length
followed by the string data (this is indicated below by <tt class="docutils literal"><span class="pre">L<...></span></tt>)
except when the string is the last or only thing in the contents in
which case we know the length because we know the length of the contents
so we don't need to explicitly specify it.</p>
<p>Integers are encoded using the same encoding used for string lengths
(indicated by <tt class="docutils literal"><span class="pre">I<...></span></tt> below).</p>
<p>Floating pointing values are passed using a bit packed encoding of the
sign and exponent and a base-256 encoding of the mantissa which avoids
any rounding issues (assuming that both machines have FLT_RADIX equal
to some power of 2). This is indicated by <tt class="docutils literal"><span class="pre">F<...></span></tt> below.</p>
<p>Boolean values are passed as a single byte which is the ASCII character
value for <tt class="docutils literal">0</tt> or <tt class="docutils literal">1</tt>. This is indicated by <tt class="docutils literal"><span class="pre">B<...></span></tt> below.</p>
<div class="section" id="server-greeting-and-statistics">
<h1>Server greeting and statistics</h1>
<ul class="simple">
<li><tt class="docutils literal">REPLY_GREETING <protocol major version> <protocol minor version> I<db doc count> I<last docid> B<has <span class="pre">positions?></span> I<db total length> <UUID></tt></li>
</ul>
<p>The protocol major and minor versions are passed as a single byte each
(e.g. <tt class="docutils literal">'\x1e\x01'</tt> for version 30.1). The server and client must
understand the same protocol major version, and the server protocol
minor version must be greater than or equal to that of the client (this
means that the server understands newer MSG_<em>XXX</em>, but will only send
newer REPLY_<em>YYY</em> in response to an appropriate client message.</p>
</div>
<div class="section" id="exception">
<h1>Exception</h1>
<ul class="simple">
<li><tt class="docutils literal">REPLY_EXCEPTION <serialised <span class="pre">Xapian::Error</span> object></tt></li>
</ul>
<p>If an unknown exception is caught by the server, this message is sent
but with empty contents.</p>
<p>This message can be sent at any point - the serialised exception is
unserialised by the client and thrown. The server and client both abort
any current sequence of messages.</p>
</div>
<div class="section" id="write-access">
<h1>Write Access</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_WRITEACCESS</tt></li>
<li><tt class="docutils literal">REPLY_UPDATE I<db doc count> I<last docid> B<has <span class="pre">positions?></span> I<db total length> <UUID></tt></li>
</ul>
<p>The reply is the same as for <tt class="docutils literal">MSG_UPDATE</tt>. If write access isn't
supported or the database is locked by another writer, then an exception
is thrown.</p>
<p>By default the server is also read-only, even if writing is supported.
If the client wants to be able to write, it needs to request this
explicitly. We do this so that the same server can support multiple
read-only clients and one writing client at once, without the protocol
for read-only clients requiring an extra message. The overhead of an
extra message exchange for a writer is unlikely to matter as indexing is
rarely so real-time critical as searching.</p>
</div>
<div class="section" id="all-terms">
<h1>All Terms</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_ALLTERMS</tt></li>
<li><tt class="docutils literal">REPLY_ALLTERMS I<term freq> L<term name></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="term-exists">
<h1>Term Exists</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_TERMEXISTS <term name></tt></li>
<li><tt class="docutils literal">REPLY_TERMEXISTS</tt> or <tt class="docutils literal">REPLY_TERMDOESNTEXIST</tt></li>
</ul>
</div>
<div class="section" id="term-frequency">
<h1>Term Frequency</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_TERMFREQ <term name></tt></li>
<li><tt class="docutils literal">REPLY_TERMFREQ I<term freq></tt></li>
</ul>
</div>
<div class="section" id="collection-frequency">
<h1>Collection Frequency</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_COLLFREQ <term name></tt></li>
<li><tt class="docutils literal">REPLY_COLLFREQ I<collection freq></tt></li>
</ul>
</div>
<div class="section" id="document">
<h1>Document</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_DOCUMENT I<document id></tt></li>
<li><tt class="docutils literal">REPLY_DOCDATA <document data></tt></li>
<li><tt class="docutils literal">REPLY_VALUE I<value no> <value></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="document-length">
<h1>Document Length</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_DOCLENGTH I<document id></tt></li>
<li><tt class="docutils literal">REPLY_DOCLENGTH I<document length></tt></li>
</ul>
</div>
<div class="section" id="keep-alive">
<h1>Keep Alive</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_KEEPALIVE</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="reopen">
<h1>Reopen</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_REOPEN</tt></li>
<li><tt class="docutils literal">REPLY_UPDATE I<db doc count> I<last docid> B<has <span class="pre">positions?></span> I<db total length> <UUID></tt></li>
</ul>
<p>The reply is the same as for <tt class="docutils literal">MSG_UPDATE</tt>.</p>
</div>
<div class="section" id="query">
<h1>Query</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_QUERY L<serialised <span class="pre">Xapian::Query</span> object> I<query length> I<collapse max> [I<collapse key number> (if collapse_max <span class="pre">non-zero)]</span> <docid order> I<sort key number> <sort by> B<sort value forward> <percent cutoff> F<weight cutoff> <serialised <span class="pre">Xapian::Weight</span> object> <serialised <span class="pre">Xapian::RSet</span> object> [L<serialised <span class="pre">Xapian::MatchSpy</span> <span class="pre">object>...]</span></tt></li>
<li><tt class="docutils literal">REPLY_STATS <serialised Stats object></tt></li>
<li><tt class="docutils literal">MSG_GETMSET I<first> I<max items> I<check at least> <serialised global Stats object></tt></li>
<li><tt class="docutils literal">REPLY_RESULTS L<the result of calling serialise_results() on each <span class="pre">Xapian::MatchSpy></span> <serialised <span class="pre">Xapian::MSet</span> object></tt></li>
</ul>
<p>docid order is <tt class="docutils literal">'0'</tt>, <tt class="docutils literal">'1'</tt> or <tt class="docutils literal">'2'</tt>.</p>
<p>sort by is <tt class="docutils literal">'0'</tt>, <tt class="docutils literal">'1'</tt>, <tt class="docutils literal">'2'</tt> or <tt class="docutils literal">'3'</tt>.</p>
</div>
<div class="section" id="termlist">
<h1>Termlist</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_TERMLIST I<document id></tt></li>
<li><tt class="docutils literal">REPLY_DOCLENGTH I<document length></tt></li>
<li><tt class="docutils literal">REPLY_TERMLIST I<wdf> I<term freq> L<term name></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="positionlist">
<h1>Positionlist</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_POSITIONLIST I<document id> <term name></tt></li>
<li><tt class="docutils literal">REPLY_POSITIONLIST I<termpos delta - 1></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
<p>Since positions must be strictly monotonically increasing, we encode
<tt class="docutils literal">(pos - lastpos - 1)</tt> so that small differences between large position
values can still be encoded compactly. The first position is encoded as
its true value.</p>
</div>
<div class="section" id="postlist">
<h1>Postlist</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_POSTLIST <term name></tt></li>
<li><tt class="docutils literal">REPLY_POSTLISTSTART I<termfreq> I<collfreq></tt></li>
<li><tt class="docutils literal">REPLY_POSTLISTITEM I<docid delta - 1> I<wdf> F<document length></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
<p>Since document IDs in postlists must be strictly monotonically
increasing, we encode <tt class="docutils literal">(docid - lastdocid - 1)</tt> so that small
differences between large document IDs can still be encoded compactly.
The first document ID is encoded as its true value - 1 (since document
IDs are always > 0).</p>
</div>
<div class="section" id="shut-down">
<h1>Shut Down</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_SHUTDOWN</tt></li>
</ul>
<p>No reply is sent - this message signals that the client has ended the
session.</p>
</div>
<div class="section" id="update">
<h1>Update</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_UPDATE</tt></li>
<li><tt class="docutils literal">REPLY_UPDATE I<db doc count> I<last docid> B<has <span class="pre">positions?></span> I<db total length> <UUID></tt></li>
</ul>
<p>Only useful for a <tt class="docutils literal">WritableDatabase</tt> (since the same statistics are
sent when the connection is initiated in the <tt class="docutils literal">REPLY_GREETING</tt> and they
don't change if the database can't change).</p>
</div>
<div class="section" id="add-document">
<h1>Add document</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_ADDDOCUMENT <serialised <span class="pre">Xapian::Document</span> object></tt></li>
<li><tt class="docutils literal">REPLY_ADDDOCUMENT I<document id></tt></li>
</ul>
</div>
<div class="section" id="delete-document">
<h1>Delete document</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_DELETEDOCUMENT I<document id></tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="delete-document-by-term">
<h1>Delete document by term</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_DELETEDOCUMENTTERM <term name></tt></li>
</ul>
</div>
<div class="section" id="replace-document">
<h1>Replace document</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_REPLACEDOCUMENT I<document id> <serialised <span class="pre">Xapian::Document</span> object></tt></li>
</ul>
</div>
<div class="section" id="replace-document-by-term">
<h1>Replace document by term</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_REPLACEDOCUMENTTERM L<term name> <serialised <span class="pre">Xapian::Document</span> object></tt></li>
</ul>
</div>
<div class="section" id="cancel">
<h1>Cancel</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_CANCEL</tt></li>
</ul>
</div>
<div class="section" id="commit">
<h1>Commit</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_COMMIT</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="set-metadata">
<h1>Set metadata</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_SETMETADATA L<key> <value></tt></li>
</ul>
</div>
<div class="section" id="get-metadata">
<h1>Get metadata</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_GETMETADATA <key></tt></li>
<li><tt class="docutils literal">REPLY_METADATA <value></tt></li>
</ul>
</div>
<div class="section" id="metadata-keys">
<h1>Metadata keys</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_METADATAKEYLIST <prefix></tt></li>
<li><tt class="docutils literal">REPLY_METADATAKEYLIST <key></tt></li>
<li><tt class="docutils literal">...</tt></li>
<li><tt class="docutils literal">REPLY_DONE</tt></li>
</ul>
</div>
<div class="section" id="add-spelling">
<h1>Add spelling</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_ADDSPELLING I<freqinc> <word></tt></li>
</ul>
</div>
<div class="section" id="remove-spelling">
<h1>Remove spelling</h1>
<ul class="simple">
<li><tt class="docutils literal">MSG_REMOVESPELLING I<freqdec> <word></tt></li>
</ul>
</div>
</div>
</body>
</html>
|