GSOC 2017 Project: Improving Xapian's PHP Bindings

Olly Betts olly at survex.com
Tue Mar 7 04:11:38 GMT 2017


On Fri, Mar 03, 2017 at 02:35:09PM +0530, Nihal N wrote:
> > > I'd suggest looking at the query introspection methods that exist
> > > currently and how they're implemented as a first step.
> 
>     Yes, I've looked into the Query::get_terms_being function which is
>     mentioned in the ticket history. If i am right, the query introspection
>     is to return the operator performed at the top-level nodes and return few
>     parameters like term, wqf, and position for leaf nodes. Can I get more
>     assistance regarding this?

The general concept is to be able to programmatically examine a query object
in all its details.  At present you can look at some details:

* get_type() tells you what sort of query it is
* get_num_subqueries() tells you how many subqueries it has
* get_subquery(N) allows you to access a subquery by its integer index (so you
  can drill down into complex queries)
* get_terms_begin() and get_terms_end() allow you to read the
  terms in a query - so if get_type() tells you the query is a single term, you
  can get that term.

So what you say above is about right, except you can already get the operator
(using get_type()) and the term.  And there are a few more bits of information
for particular query types.

It's probably better not to try to do everything at once - I'd suggest starting
by allowing access to the missing details of a leaf query which is a term (so
wqf and query position), and work through the process of implementing that and
submitting a patch for it.

Cheers,
    Olly



More information about the Xapian-devel mailing list