[Xapian-discuss] Emulating SQL JOIN in xapian

Olly Betts olly at survex.com
Tue Mar 3 12:13:50 GMT 2009


On Mon, Mar 02, 2009 at 10:17:48AM +0000, James Aylett wrote:
> On Mon, Mar 02, 2009 at 07:27:25AM +0000, Olly Betts wrote:
> 
> > I wonder if there's a way to achieve this with PostingSource and
> > MatchSpy.
> 
> I've never used or even looked particularly hard at PostingSource, but
> I'm guessing half of it (feeding the relevant recipient record for
> every payment record) could be done providing there's a way of
> determining the Document id of the recipient for each payment
> Document.

Well, I didn't think it through in detail...

But MatchSpy allows you to get hold of the matching documents as a
stream (rather than having to generate the whole of a potentially large
MSet and then process it).

And PostingSource would allow you to feed information from this into
a second match operation.

Together, that seems to be quite a lot of what you'd probably need to
construct a join between two databases.

> Does that allow that pair of documents to contribute weight to the
> same output document? I can't tell from the posting source docs. A
> match decider could then get rid of recipient records as needed?

A PostingSource can contribute weight.  I'm not sure how the "virtual"
documents from the join would be represented though.

Cheers,
    Olly



More information about the Xapian-discuss mailing list