HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/python3-xapian/html/introduction.html
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Python3 bindings for Xapian &#8212; Xapian Python3 Bindings 1.4.18 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/classic.css" />
    
    <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Examples" href="examples.html" />
    <link rel="prev" title="Welcome to Xapian Python Bindings’s documentation!" href="index.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="examples.html" title="Examples"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Welcome to Xapian Python Bindings’s documentation!"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Xapian Python3 Bindings 1.4.18 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Python3 bindings for Xapian</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="python3-bindings-for-xapian">
<h1><a class="toc-backref" href="#id3">Python3 bindings for Xapian</a><a class="headerlink" href="#python3-bindings-for-xapian" title="Permalink to this headline">¶</a></h1>
<div class="contents topic" id="table-of-contents">
<p class="topic-title">Table of contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#python3-bindings-for-xapian" id="id3">Python3 bindings for Xapian</a></p>
<ul>
<li><p><a class="reference internal" href="#strings" id="id4">Strings</a></p></li>
<li><p><a class="reference internal" href="#unicode" id="id5">Unicode</a></p></li>
<li><p><a class="reference internal" href="#exceptions" id="id6">Exceptions</a></p></li>
<li><p><a class="reference internal" href="#iterators" id="id7">Iterators</a></p></li>
<li><p><a class="reference internal" href="#mset" id="id8">MSet</a></p></li>
<li><p><a class="reference internal" href="#non-class-functions" id="id9">Non-Class Functions</a></p></li>
<li><p><a class="reference internal" href="#query" id="id10">Query</a></p>
<ul>
<li><p><a class="reference internal" href="#matchall-and-matchnothing" id="id11">MatchAll and MatchNothing</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#matchdecider" id="id12">MatchDecider</a></p></li>
<li><p><a class="reference internal" href="#valuerangeprocessor" id="id13">ValueRangeProcessor</a></p></li>
<li><p><a class="reference internal" href="#apache-and-mod-python-mod-wsgi" id="id14">Apache and mod_python/mod_wsgi</a></p></li>
<li><p><a class="reference internal" href="#test-suite" id="id15">Test Suite</a></p></li>
</ul>
</li>
</ul>
</div>
<p>Xapian’s Python3 bindings are packaged in the <cite>xapian</cite> module - to use
them, you’ll need to add this to your code:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">xapian</span>
</pre></div>
</div>
<p>They currently require at least Python 3.2.  We’ve not tested with
Python 3.1 - test results and any patches needed are most welcome.</p>
<p>The Python API largely follows the C++ API - the differences and
additions are noted below.</p>
<p>The <cite>examples</cite> subdirectory contains examples (based on the simple C++ example)
showing how to use the Python bindings:
<a class="reference external" href="examples/simpleindex.py">simpleindex.py</a>,
<a class="reference external" href="examples/simplesearch.py">simplesearch.py</a>,
<a class="reference external" href="examples/simpleexpand.py">simpleexpand.py</a>.
There’s also
<a class="reference external" href="examples/simplematchdecider.py">simplematchdecider.py</a>
which shows how to define a MatchDecider in Python.</p>
<section id="strings">
<h2><a class="toc-backref" href="#id4">Strings</a><a class="headerlink" href="#strings" title="Permalink to this headline">¶</a></h2>
<p>The Xapian C++ API is largely agnostic about character encoding, and uses the
<cite>std::string</cite> type as an opaque container for a sequence of bytes.
In places where the bytes represent text (for example, in the
<cite>Stem</cite>, <cite>QueryParser</cite> and <cite>TermGenerator</cite> classes), UTF-8 encoding is used.  In
order to wrap this for Python, <cite>std::string</cite> is mapped to/from the Python
<cite>bytes</cite> type.</p>
<p>As a convenience, you can also pass Python
<cite>str</cite> objects as parameters where this is appropriate, which will be
converted to UTF-8 encoded text.  Where <cite>std::string</cite> is
returned, it’s always mapped to <cite>bytes</cite> in Python, which you can
convert to a Python <cite>str</cite> by calling <cite>.decode(‘utf-8’)</cite>
on it like so:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">doc</span><span class="o">.</span><span class="n">termlist</span><span class="p">():</span>
  <span class="nb">print</span><span class="p">(</span><span class="n">i</span><span class="o">.</span><span class="n">term</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s1">&#39;utf-8&#39;</span><span class="p">))</span>
</pre></div>
</div>
</section>
<section id="unicode">
<h2><a class="toc-backref" href="#id5">Unicode</a><a class="headerlink" href="#unicode" title="Permalink to this headline">¶</a></h2>
<p>Currently Xapian doesn’t have built-in support for normalising Unicode, so
if you want to normalise Unicode text, you’ll need to do so in Python.  The
standard <cite>unicodedata</cite> module provides a way to do this - you probably want the
<cite>NFKC</cite> normalisation scheme, so normalising a query string prior to parsing it
would look something like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">query_string</span> <span class="o">=</span> <span class="n">get_query_string</span><span class="p">()</span>
<span class="n">query_string</span> <span class="o">=</span> <span class="n">unicodedata</span><span class="o">.</span><span class="n">normalize</span><span class="p">(</span><span class="s1">&#39;NFKC&#39;</span><span class="p">,</span> <span class="n">query_string</span><span class="p">)</span>
<span class="n">qp</span> <span class="o">=</span> <span class="n">xapian</span><span class="o">.</span><span class="n">QueryParser</span><span class="p">()</span>
<span class="n">query_obj</span> <span class="o">=</span> <span class="n">qp</span><span class="o">.</span><span class="n">parse_query</span><span class="p">(</span><span class="n">query_string</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="exceptions">
<h2><a class="toc-backref" href="#id6">Exceptions</a><a class="headerlink" href="#exceptions" title="Permalink to this headline">¶</a></h2>
<p>Xapian exceptions are translated into Python exceptions with the same names
and inheritance hierarchy as the C++ exception classes.  The base class of
all Xapian exceptions is the <cite>xapian.Error</cite> class, and this in
turn is a child of the standard python <cite>exceptions.Exception</cite>
class.</p>
<p>This means that programs can trap all xapian exceptions using <cite>except
xapian.Error</cite>, and can trap all exceptions which don’t indicate that
the program should terminate using <cite>except Exception</cite>.</p>
</section>
<section id="iterators">
<h2><a class="toc-backref" href="#id7">Iterators</a><a class="headerlink" href="#iterators" title="Permalink to this headline">¶</a></h2>
<p>The iterator classes in the Xapian C++ API are wrapped in a Pythonic style.
The following are supported (where marked as “default iterator”, it means
<cite>__iter__()</cite> does the right thing, so you can for instance use
<cite>for term in document</cite> to iterate over terms in a Document object):</p>
<table class="docutils align-default" id="id1">
<caption><span class="caption-text">Python iterators</span><a class="headerlink" href="#id1" title="Permalink to this table">¶</a></caption>
<colgroup>
<col style="width: 20%" />
<col style="width: 34%" />
<col style="width: 32%" />
<col style="width: 14%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Class</p></th>
<th class="head"><p>Python Method</p></th>
<th class="head"><p>Equivalent C++ Method</p></th>
<th class="head"><p>Iterator type</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><cite>MSet</cite></p></td>
<td><p>default iterator</p></td>
<td><p><cite>begin()</cite></p></td>
<td><p><cite>MSetIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>ESet</cite></p></td>
<td><p>default iterator</p></td>
<td><p><cite>begin()</cite></p></td>
<td><p><cite>ESetIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Enquire</cite></p></td>
<td><p><cite>matching_terms()</cite></p></td>
<td><p><cite>get_matching_terms_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Query</cite></p></td>
<td><p>default iterator</p></td>
<td><p><cite>get_terms_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Database</cite></p></td>
<td><p><cite>allterms()</cite> (and default iterator)</p></td>
<td><p><cite>allterms_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Database</cite></p></td>
<td><p><cite>postlist(term)</cite></p></td>
<td><p><cite>postlist_begin(term)</cite></p></td>
<td><p><cite>PostingIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Database</cite></p></td>
<td><p><cite>termlist(docid)</cite></p></td>
<td><p><cite>termlist_begin(docid)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Database</cite></p></td>
<td><p><cite>positionlist(docid, term)</cite></p></td>
<td><p><cite>positionlist_begin(docid, term)</cite></p></td>
<td><p><cite>PositionIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Database</cite></p></td>
<td><p><cite>metadata_keys(prefix)</cite></p></td>
<td><p><cite>metadata_keys(prefix)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Database</cite></p></td>
<td><p><cite>spellings()</cite></p></td>
<td><p><cite>spellings_begin(term)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Database</cite></p></td>
<td><p><cite>synonyms(term)</cite></p></td>
<td><p><cite>synonyms_begin(term)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Database</cite></p></td>
<td><p><cite>synonym_keys(prefix)</cite></p></td>
<td><p><cite>synonym_keys_begin(prefix)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>Document</cite></p></td>
<td><p><cite>values()</cite></p></td>
<td><p><cite>values_begin()</cite></p></td>
<td><p><cite>ValueIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>Document</cite></p></td>
<td><p><cite>termlist()</cite> (and default iterator)</p></td>
<td><p><cite>termlist_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>QueryParser</cite></p></td>
<td><p><cite>stoplist()</cite></p></td>
<td><p><cite>stoplist_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>QueryParser</cite></p></td>
<td><p><cite>unstemlist(term)</cite></p></td>
<td><p><cite>unstem_begin(term)</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>ValueCountMatchSpy</cite></p></td>
<td><p><cite>values()</cite></p></td>
<td><p><cite>values_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>ValueCountMatchSpy</cite></p></td>
<td><p><cite>top_values()</cite></p></td>
<td><p><cite>top_values_begin()</cite></p></td>
<td><p><cite>TermIter</cite></p></td>
</tr>
</tbody>
</table>
<p>The pythonic iterators generally return Python objects, with properties
available as attribute values, with lazy evaluation where appropriate.  An
exception is <cite>PositionIter</cite> (as returned by <cite>Database.positionlist</cite>), which
returns an integer.</p>
<p>The lazy evaluation is mainly transparent, but does become visible in one situation: if you keep an object returned by an iterator, without evaluating its properties to force the lazy evaluation to happen, and then move the iterator forward, the object may no longer be able to efficiently perform the lazy evaluation.  In this situation, an exception will be raised indicating that the information requested wasn’t available.  This will only happen for a few of the properties - most are either not evaluated lazily (because the underlying Xapian implementation doesn’t evaluate them lazily, so there’s no advantage in lazy evaluation), or can be accessed even after the iterator has moved.  The simplest work around is to evaluate any properties you wish to use which are affected by this before moving the iterator.  The complete set of iterator properties affected by this is:</p>
<blockquote>
<div><ul class="simple">
<li><p><cite>Database.allterms</cite> (also accessible as <cite>Database.__iter__</cite>): <cite>termfreq</cite></p></li>
<li><p><cite>Database.termlist</cite>: <cite>termfreq</cite> and <cite>positer</cite></p></li>
<li><p><cite>Document.termlist</cite> (also accessible as <cite>Document.__iter__</cite>): <cite>termfreq</cite> and <cite>positer</cite></p></li>
<li><p><cite>Database.postlist</cite>: <cite>positer</cite></p></li>
</ul>
</div></blockquote>
</section>
<section id="mset">
<h2><a class="toc-backref" href="#id8">MSet</a><a class="headerlink" href="#mset" title="Permalink to this headline">¶</a></h2>
<p>MSet objects have some additional methods to simplify access (these
work using the C++ array dereferencing):</p>
<table class="docutils align-default" id="id2">
<caption><span class="caption-text">MSet additional methods</span><a class="headerlink" href="#id2" title="Permalink to this table">¶</a></caption>
<colgroup>
<col style="width: 47%" />
<col style="width: 53%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Method name</p></th>
<th class="head"><p>Explanation</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><cite>get_hit(i)</cite></p></td>
<td><p>returns MSetItem at index i</p></td>
</tr>
<tr class="row-odd"><td><p><cite>get_document_percentage(i)</cite></p></td>
<td><p><cite>convert_to_percent(get_hit(i))</cite></p></td>
</tr>
<tr class="row-even"><td><p><cite>get_document(i)</cite></p></td>
<td><p><cite>get_hit(i).get_document()</cite></p></td>
</tr>
<tr class="row-odd"><td><p><cite>get_docid(i)</cite></p></td>
<td><p><cite>get_hit(i).get_docid()</cite></p></td>
</tr>
</tbody>
</table>
<p>Two MSet objects are equal if they have the same number and maximum possible
number of members, and if every document member of the first MSet exists at the
same index in the second MSet, with the same weight.</p>
</section>
<section id="non-class-functions">
<h2><a class="toc-backref" href="#id9">Non-Class Functions</a><a class="headerlink" href="#non-class-functions" title="Permalink to this headline">¶</a></h2>
<p>The C++ API contains a few non-class functions (the Database factory
functions, and some functions reporting version information), which are
wrapped like so for Python 3:</p>
<blockquote>
<div><ul class="simple">
<li><p><cite>Xapian::version_string()</cite> is wrapped as <cite>xapian.version_string()</cite></p></li>
<li><p><cite>Xapian::major_version()</cite> is wrapped as <cite>xapian.major_version()</cite></p></li>
<li><p><cite>Xapian::minor_version()</cite> is wrapped as <cite>xapian.minor_version()</cite></p></li>
<li><p><cite>Xapian::revision()</cite> is wrapped as <cite>xapian.revision()</cite></p></li>
<li><p><cite>Xapian::Remote::open()</cite> is wrapped as <cite>xapian.remote_open()</cite> (both
the TCP and “program” versions are wrapped - the SWIG wrapper checks the parameter list to
decide which to call).</p></li>
<li><p><cite>Xapian::Remote::open_writable()</cite> is wrapped as <cite>xapian.remote_open_writable()</cite> (both
the TCP and “program” versions are wrapped - the SWIG wrapper checks the parameter list to
decide which to call).</p></li>
</ul>
</div></blockquote>
<p>The following were deprecated in the C++ API before the Python 3 bindings saw
a stable release, so are not wrapped for Python 3:</p>
<blockquote>
<div><ul class="simple">
<li><p><cite>Xapian::Auto::open_stub()</cite></p></li>
<li><p><cite>Xapian::Chert::open()</cite></p></li>
<li><p><cite>Xapian::InMemory::open()</cite></p></li>
</ul>
</div></blockquote>
<p>The version of the bindings in use is available as <cite>xapian.__version__</cite> (as
recommended by PEP 396).  This may not be the same as <cite>xapian.version_string()</cite>
as the latter is the version of xapian-core (the C++ library) in use.</p>
</section>
<section id="query">
<h2><a class="toc-backref" href="#id10">Query</a><a class="headerlink" href="#query" title="Permalink to this headline">¶</a></h2>
<p>In C++ there’s a Xapian::Query constructor which takes a query operator and
start/end iterators specifying a number of terms or queries, plus an optional
parameter.  In Python, this is wrapped to accept any Python sequence (for
example a list or tuple) of terms or queries (or even a mixture of terms
and queries).  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">subq</span> <span class="o">=</span> <span class="n">xapian</span><span class="o">.</span><span class="n">Query</span><span class="p">(</span><span class="n">xapian</span><span class="o">.</span><span class="n">Query</span><span class="o">.</span><span class="n">OP_AND</span><span class="p">,</span> <span class="s2">&quot;hello&quot;</span><span class="p">,</span> <span class="s2">&quot;world&quot;</span><span class="p">)</span>
<span class="n">q</span> <span class="o">=</span> <span class="n">xapian</span><span class="o">.</span><span class="n">Query</span><span class="p">(</span><span class="n">xapian</span><span class="o">.</span><span class="n">Query</span><span class="o">.</span><span class="n">OP_AND</span><span class="p">,</span> <span class="p">[</span><span class="n">subq</span><span class="p">,</span> <span class="s2">&quot;foo&quot;</span><span class="p">,</span> <span class="n">xapian</span><span class="o">.</span><span class="n">Query</span><span class="p">(</span><span class="s2">&quot;bar&quot;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span>
</pre></div>
</div>
<section id="matchall-and-matchnothing">
<h3><a class="toc-backref" href="#id11">MatchAll and MatchNothing</a><a class="headerlink" href="#matchall-and-matchnothing" title="Permalink to this headline">¶</a></h3>
<p>As of 1.1.1, these are wrapped as <cite>xapian.Query.MatchAll</cite> and
<cite>xapian.Query.MatchNothing</cite>.</p>
</section>
</section>
<section id="matchdecider">
<h2><a class="toc-backref" href="#id12">MatchDecider</a><a class="headerlink" href="#matchdecider" title="Permalink to this headline">¶</a></h2>
<p>Custom MatchDeciders can be created in Python by subclassing
<cite>xapian.MatchDecider</cite> and defining a <cite>__call__</cite> method
that will do the work.  Make sure you call the base class constructor in
your constructor.  The simplest example (which does nothing useful) would be as
follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">mymatchdecider</span><span class="p">(</span><span class="n">xapian</span><span class="o">.</span><span class="n">MatchDecider</span><span class="p">):</span>
  <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="n">xapian</span><span class="o">.</span><span class="n">MatchDecider</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

  <span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">doc</span><span class="p">):</span>
    <span class="k">return</span> <span class="mi">1</span>
</pre></div>
</div>
</section>
<section id="valuerangeprocessor">
<h2><a class="toc-backref" href="#id13">ValueRangeProcessor</a><a class="headerlink" href="#valuerangeprocessor" title="Permalink to this headline">¶</a></h2>
<p>The ValueRangeProcessor class (and its subclasses) provide an operator() method
(which is exposed in python as a __call__() method, making the class instances
into callables).  This method checks whether a beginning and end of a range are
in a format understood by the ValueRangeProcessor, and if so, converts the
beginning and end into strings which sort appropriately.  ValueRangeProcessors
can be defined in python (and then passed to the QueryParser), or there are
several default built-in ones which can be used.</p>
<p>In C++ the operator() method takes two std::string arguments by reference,
which the subclassed method can modify, and returns a value slot number.
In Python, we wrap this by passing two <cite>bytes</cite> objects to
__call__ and having it return a tuple of (value_slot, modified_begin,
modified_end).  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">vrp</span> <span class="o">=</span> <span class="n">xapian</span><span class="o">.</span><span class="n">NumberValueRangeProcessor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;$&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span>
<span class="n">a</span> <span class="o">=</span> <span class="s1">&#39;$10&#39;</span>
<span class="n">b</span> <span class="o">=</span> <span class="s1">&#39;20&#39;</span>
<span class="n">slot</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">vrp</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
</pre></div>
</div>
<p>You can implement your own ValueRangeProcessor in Python.  The Python
implementation should override the __call__() method with its own
implementation, which returns a tuple as above.  For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyVRP</span><span class="p">(</span><span class="n">xapian</span><span class="o">.</span><span class="n">ValueRangeProcessor</span><span class="p">):</span>
  <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="n">xapian</span><span class="o">.</span><span class="n">ValueRangeProcessor</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
  <span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">begin</span><span class="p">,</span> <span class="n">end</span><span class="p">):</span>
    <span class="k">return</span> <span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="s2">&quot;A&quot;</span><span class="o">+</span><span class="n">begin</span><span class="p">,</span> <span class="s2">&quot;B&quot;</span><span class="o">+</span><span class="n">end</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="apache-and-mod-python-mod-wsgi">
<h2><a class="toc-backref" href="#id14">Apache and mod_python/mod_wsgi</a><a class="headerlink" href="#apache-and-mod-python-mod-wsgi" title="Permalink to this headline">¶</a></h2>
<p>Prior to Xapian 1.3.0, applications which use the xapian module had to be
run in the main interpreter under mod_python and mod_wsgi.  As of 1.3.0,
the xapian module no longer uses Python’s simplified GIL state API, and so this
restriction should no longer apply.</p>
</section>
<section id="test-suite">
<h2><a class="toc-backref" href="#id15">Test Suite</a><a class="headerlink" href="#test-suite" title="Permalink to this headline">¶</a></h2>
<p>The Python bindings come with a test suite, consisting of two test files:
<cite>smoketest.py</cite> and <cite>pythontest.py</cite>. These are run by the <cite>make check</cite> command,
or may be run manually.  By default, they will display the names of any tests
which failed, and then display a count of tests which run and which failed.
The verbosity may be increased by setting the <cite>VERBOSE</cite> environment variable,
for example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">check</span> <span class="n">VERBOSE</span><span class="o">=</span><span class="mi">1</span>
</pre></div>
</div>
<p>Setting VERBOSE to 1 will display detailed information about failures, and a
value of 2 will display further information about the progress of tests.</p>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Python3 bindings for Xapian</a><ul>
<li><a class="reference internal" href="#strings">Strings</a></li>
<li><a class="reference internal" href="#unicode">Unicode</a></li>
<li><a class="reference internal" href="#exceptions">Exceptions</a></li>
<li><a class="reference internal" href="#iterators">Iterators</a></li>
<li><a class="reference internal" href="#mset">MSet</a></li>
<li><a class="reference internal" href="#non-class-functions">Non-Class Functions</a></li>
<li><a class="reference internal" href="#query">Query</a><ul>
<li><a class="reference internal" href="#matchall-and-matchnothing">MatchAll and MatchNothing</a></li>
</ul>
</li>
<li><a class="reference internal" href="#matchdecider">MatchDecider</a></li>
<li><a class="reference internal" href="#valuerangeprocessor">ValueRangeProcessor</a></li>
<li><a class="reference internal" href="#apache-and-mod-python-mod-wsgi">Apache and mod_python/mod_wsgi</a></li>
<li><a class="reference internal" href="#test-suite">Test Suite</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">Welcome to Xapian Python Bindings’s documentation!</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="examples.html"
                        title="next chapter">Examples</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/introduction.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="examples.html" title="Examples"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Welcome to Xapian Python Bindings’s documentation!"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Xapian Python3 Bindings 1.4.18 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">Python3 bindings for Xapian</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright .
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.3.2.
    </div>
  </body>
</html>