[Xapian-devel] Re: [Xapian-discuss] Searching subset of documents
Olly Betts
olly at survex.com
Fri Jun 2 14:43:15 BST 2006
On Fri, Jun 02, 2006 at 04:34:38AM -0600, Rusty Conover wrote:
>
> On Jun 2, 2006, at 3:15 AM, James Aylett wrote:
>
> >On Fri, Jun 02, 2006 at 02:01:13AM +0100, Olly Betts wrote:
> >
> >> class MySQLFilter : public Xapian::ExternalPostingSource;
> >>
> >> Xapian::QueryParser qp;
> >> // configure qp
> >> Xapian::Query query = qp.parse_query(query_string);
> >> Xapian::Query sql_filter(new MySQLFilter(/* some parameters */));
> >
> >Surely the type will be Xapian::ExternalPostingSource, not
> >Xapian::Query?
No, not if Xapian::Query has a constructor such as:
Xapian::Query::Query(Xapian::ExternalPostingSource *);
> Please disregard my previous email, after some hours of hacking I got
> it all working, I think. Including a nice wrapper in perl with
> Search::Xapian. I'll try and clean it up and send a diff later today
> after I finish testing it for a while.
Cool.
> I did have to hack the Xapian::Query object to add a new OP type of
> OP_EXTERNAL_POST_LIST, and store a reference to the implementation of
> the ExternalPostingSource interface in the Internal class. Then some
> changes in localmatch.cc, to have postlist_from_query just create a
> new instance of ExternalSourcePostList with the reference to the
> implementation provided to the Query constructor.
That sounds about right. I suspect a new OP_* code isn't necessarily
required since you could just look if the ExternalPostingSource pointer
is non-NULL, but if it's cleaner to have a new OP_* code I doubt it's
a problem.
Cheers,
Olly
More information about the Xapian-devel
mailing list