[Xapian-devel] Searching subset of documents

Rusty Conover rconover at infogears.com
Fri Jun 2 05:42:30 BST 2006


On Jun 1, 2006, at 7:01 PM, Olly Betts wrote:

> On Thu, Jun 01, 2006 at 06:11:04PM -0600, Rusty Conover wrote:
>> Thanks for your help so far.  I'm a stuck on the problem of how to
>> properly expose this new class, called ExternalSourcePostList to
>> public users of the Xapian API.   I've created matcher/
>> externalsourcepostlist.cc and matcher/externalsourcepostlist.h.
>>
>> It seems the header "postlist.h" isn't installed when Xapian is
>> installed, so there needs to be some housekeeping allow this class to
>> be used but not show its internal bits.  This I'd like a little help
>> with.
>
> The PostList class is an internal detail currently, and I think  
> probably
> should stay that way.  We do want to expose a similar interface to  
> that
> white PostList currently has, but we don't need all the methods of
> PostList and it may be unhelpful to limit changes to PostList's
> interface by exposing it directly.
>
> Having had this circulating the recesses of my brain for a few  
> hours, I
> think the best way to fit this into the external API would probably
> look something like this in use (names are the first that came to  
> mind,
> so could no doubt be improved upon):
>
>     class MySQLFilter : public Xapian::ExternalPostingSource {
> 	    // any private SQL-related data
> 	public:
> 	    // ctor
> 	    // dtor
> 	    // size reporting methods
> 	    // next()
> 	    // skip_to()
> 	    // at_end()
> 	    // optionally weight/max_weight, defaulting to unweighted
>     };
>

Olly,

What's the right way to specify the inheritance for this interface so  
that this can be passed to the Query constructor, so far this is the  
interface I'm envisioning:

class ExternalPostingSource  {
     public:
	/** Decide whether we want this document to be in the mset.
	 */
	virtual ExternalPostingSource *next(Xapian::weight w_min);

	virtual ExternalPostingSource *skip_to(Xapian::docid did,  
Xapian::weight w_min);
	
	virtual bool at_end();

	virtual Xapian::docid get_docid();
	virtual std::string get_description();

	virtual ~ExternalPostingSource();
	virtual ExternalPostingSource();
};

Thanks,

Rusty
--
Rusty Conover
CTO, InfoGears Inc.
Web: http://www.infogears.com
Phone: 406-587-5432






More information about the Xapian-devel mailing list