<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is free software; you can redistribute it and/or</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># modify it under the terms of the GNU General Public License</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># as published by the Free Software Foundation; either version 2 </tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># of the License, or (at your option) any later version.</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># GNU General Public License for more details. </tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You should have received a copy of the GNU General Public License</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># along with this program; if not, write to the Free Software</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-docstring">Store implementation on top of Berkeley DB (>= 4.1)</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring">This store is suitable for large databases, or for cases where the</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-docstring">startup time is more important.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># key: id of the enum</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"><tt class="py-comment"># Python ships the bsddb module as 'bsddb', whereas when fetched as a</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># standalone package it is named 'bsddb3'. For the moment, we need a</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># version that is not yet shipped.</tt> </tt>
</div><div id="_idxadd-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_idxadd-expanded"><a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-docstring">""" Mark id as matching all the words. """</tt> </tt>
</div><div id="RSDB-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="RSDB-expanded"><a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-docstring">""" Virtual result set that loops over the full database"""</tt> </tt>
</div><div id="_TxnEnv-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_TxnEnv-expanded"><a name="L324"></a><tt class="py-lineno">324</tt> <tt class="py-line"> <tt class="py-docstring">""" I pretend to be a DBEnv, with overloadable txn management</tt> </tt>
<a name="L325"></a><tt class="py-lineno">325</tt> <tt class="py-line"><tt class="py-docstring"> functions. I work when transactions are enabled. """</tt> </tt>
</div><div id="_NoTxnEnv-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_NoTxnEnv-expanded"><a name="L344"></a><tt class="py-lineno">344</tt> <tt class="py-line"> <tt class="py-docstring">""" I pretend to be a DBEnv, with overloadable txn management</tt> </tt>
<a name="L345"></a><tt class="py-lineno">345</tt> <tt class="py-line"><tt class="py-docstring"> functions. I work when transactions are disabled. """</tt> </tt>
<a name="L372"></a><tt class="py-lineno">372</tt> <tt class="py-line"> <tt class="py-comment"># Instantiate the proper environment (yes, this could be done</tt> </tt>
<a name="L373"></a><tt class="py-lineno">373</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># with an if :-))</tt> </tt>
<a name="L445"></a><tt class="py-lineno">445</tt> <tt class="py-line"> <tt class="py-comment"># Forward index: for each word as a key, return an array</tt> </tt>
<a name="L450"></a><tt class="py-lineno">450</tt> <tt class="py-line"> <tt class="py-comment"># Backward index: for each record, list the words it matches</tt> </tt>
<a name="L518"></a><tt class="py-lineno">518</tt> <tt class="py-line"> <tt class="py-comment"># Be careful to always point after the last serial id used.</tt> </tt>
<a name="L556"></a><tt class="py-lineno">556</tt> <tt class="py-line"> <tt class="py-comment"># Start by doing the update in the external tables, which</tt> </tt>
<a name="L557"></a><tt class="py-lineno">557</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># might still want to access the previous version</tt> </tt>
<a name="L581"></a><tt class="py-lineno">581</tt> <tt class="py-line"> <tt class="py-comment"># Start by cleaning up dependencies, as they might wish to</tt> </tt>
<a name="L582"></a><tt class="py-lineno">582</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># access the item a last time.</tt> </tt>
</div><div id="Database._idxadd-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Database._idxadd-expanded"><a name="L611"></a><tt class="py-lineno">611</tt> <tt class="py-line"> <tt class="py-comment"># We need to insert the current record in both the backward</tt> </tt>