[Xapian-tickets] [Xapian] #250: replace_document should make minimal changes to database file
Xapian
nobody at xapian.org
Fri Dec 11 11:39:32 GMT 2009
#250: replace_document should make minimal changes to database file
---------------------------+------------------------------------------------
Reporter: richard | Owner: richard
Type: enhancement | Status: assigned
Priority: normal | Milestone: 1.2.x
Component: Backend-Chert | Version: SVN trunk
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
---------------------------+------------------------------------------------
Changes (by richard):
* owner: olly => richard
* status: new => assigned
Comment:
Generally, this patch looks good, and passes the testsuite for me (I've
not done any timings for it, though). I've refactored the patch a little,
to make it a bit more readable:
- I've pulled the comparison of positionlists out into a separate
function, and called
that from the one place in the code where the value is wanted, rather than
calculating it in advance.
- It's a bit more conventional to use -1, 0 and 1 as values for cmp,
rather than
-2, 0 and 2, so I've changed it to do that.
I'd also rename "termlist" to orig_termlist (or old_termlist), and "term"
to
"new_termiter" - makes the code a little more readable IMO.
There are some other potential improvements in this area in Xapian, and
the code currently in Xapian could do with some serious refactoring to
make it more readable and easier to maintain and modify.
In particular, one improvement we'd like to do is adding a flag to
Xapian::Document to indicate if the positions have been modified at all,
and using this flag to avoid needing to compare the old positionlist
values with the new ones if they haven't been.
After discussion with Olly, trying to work out how to best get this
functionality integrated with trunk, and able to be easily and safely
backported to the 1.0.x series, I'm going to try and do the following:
- Add a flag to Xapian::Document to keep track of modifications to the
positions. This should be a pretty non-invasive patch, so we'd like to
apply it first for ease of backporting.
- Do minimal refactoring of replace_document() to make it more readable.
- Apply Kan-Ru Chen's patch, or something along those lines.
- Possibly do further refactoring of replace_document().
--
Ticket URL: <http://trac.xapian.org/ticket/250#comment:11>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list