[Xapian-tickets] [Xapian] #295: Add support for multi and remote databases with PostingSources
Xapian
nobody at xapian.org
Fri Feb 6 23:48:52 GMT 2009
#295: Add support for multi and remote databases with PostingSources
-------------------------+--------------------------------------------------
Reporter: richard | Owner: richard
Type: enhancement | Status: assigned
Priority: normal | Milestone: 1.1.0
Component: Matcher | Version: SVN trunk
Severity: normal | Resolution:
Keywords: | Blockedby:
Platform: All | Blocking: 206
-------------------------+--------------------------------------------------
Comment(by richard):
Thinking about the remaining issues listed in comment:4 :
- I think calling clone() in the Query constructor (as done in the patch)
is right. The only potential downside is if clone() is very expensive -
in which case, the implementor of the PostingSource should probably move
the part which is expensive to clone into a reference counted resource.
Doing it this way makes the code neat, and also allows users not to worry
about ensuring the original PostingSource remains valid (as long as they
implement a clone() method).
- I don't think the database should be set in clone() - I'm fairly
convinced that reset() is the correct place to specify the database. A
big reason for this is that currently clone() doesn't need to be
implemented - if the database was set by it, users who don't want to
handle the complication of multiple databases would need to implement a
clone() method which returns NULL, but modifies the state of the
PostingSource whose clone method was called. This would be bad design,
but would also require casting away const, since the clone() method is
(and should be) const. Also, it would be unclear what database should be
passed to the clone() method called by the Query constructor when passed a
posting source.
- Still don't know how to avoid the const_cast.
- Have done some review of the patch, but it's basically fine apart from
the const_cast as far as I can see.
I think the const_cast is a livable ugliness, so I'm inclined to apply the
latest patch fairly soon unless there are major objections.
--
Ticket URL: <http://trac.xapian.org/ticket/295#comment:8>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list