[Xapian-tickets] [Xapian] #491: calling replace_document() twice doubles the size of the database
Xapian
nobody at xapian.org
Tue Jun 29 01:39:31 BST 2010
#491: calling replace_document() twice doubles the size of the database
--------------------+-------------------------------------------------------
Reporter: maad | Owner: olly
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version:
Severity: major | Keywords:
Blockedby: | Platform: All
Blocking: |
--------------------+-------------------------------------------------------
Calling replace_document twice with the same key doubles the size of the
database on disk (unexpected). However when running search only one
document returned (expected). Subsequent replace_document calls do not
change the database size(expected). This is the code to replicate:
{{{
<?php
include "xapian.php";
$value="thisistest";
myreplace($value);
passthru("ls -l replace.db");
myreplace($value);
passthru("ls -l replace.db");
myreplace($value);
passthru("ls -l replace.db");
function myreplace($value)
{
try
{
// Open the database for update, creating a new database if necessary.
$database = new XapianWritableDatabase("replace.db",
Xapian::DB_CREATE_OR_OPEN);
$indexer = new XapianTermGenerator();
$stemmer = new XapianStem("english");
$indexer->set_stemmer($stemmer);
$doc = new XapianDocument();
$doc->add_term("Q$value");
$indexer->set_document($doc);
$indexer->index_text($value);
//$database->add_document($doc);
$database->replace_document("Q$value", $doc);
$database = Null;
}
catch (Exception $e)
{
print $e->getMessage() . "\n";
exit(1);
}
}
?>
}}}
Output:
{{{
total 84
-rw-r--r-- 1 alex alex 0 2010-06-28 20:30 flintlock
-rw-r--r-- 1 alex alex 12 2010-06-28 20:30 iamflint
-rw-r--r-- 1 alex alex 13 2010-06-28 20:30 position.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 position.baseB
-rw-r--r-- 1 alex alex 8192 2010-06-28 20:30 position.DB
-rw-r--r-- 1 alex alex 13 2010-06-28 20:30 postlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 postlist.baseB
-rw-r--r-- 1 alex alex 8192 2010-06-28 20:30 postlist.DB
-rw-r--r-- 1 alex alex 13 2010-06-28 20:30 record.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 record.baseB
-rw-r--r-- 1 alex alex 8192 2010-06-28 20:30 record.DB
-rw-r--r-- 1 alex alex 13 2010-06-28 20:30 termlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 termlist.baseB
-rw-r--r-- 1 alex alex 8192 2010-06-28 20:30 termlist.DB
-rw-r--r-- 1 alex alex 13 2010-06-28 20:30 value.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 value.baseB
-rw-r--r-- 1 alex alex 8192 2010-06-28 20:30 value.DB
total 124
-rw-r--r-- 1 alex alex 0 2010-06-28 20:30 flintlock
-rw-r--r-- 1 alex alex 12 2010-06-28 20:30 iamflint
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 position.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 position.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 position.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 postlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 postlist.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 postlist.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 record.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 record.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 record.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 termlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 termlist.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 termlist.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 value.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 value.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 value.DB
total 124
-rw-r--r-- 1 alex alex 0 2010-06-28 20:30 flintlock
-rw-r--r-- 1 alex alex 12 2010-06-28 20:30 iamflint
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 position.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 position.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 position.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 postlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 postlist.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 postlist.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 record.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 record.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 record.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 termlist.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 termlist.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 termlist.DB
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 value.baseA
-rw-r--r-- 1 alex alex 14 2010-06-28 20:30 value.baseB
-rw-r--r-- 1 alex alex 16384 2010-06-28 20:30 value.DB
}}}
--
Ticket URL: <http://trac.xapian.org/ticket/491>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list