[Xapian-discuss] constructing phrase queries
James Aylett
james-xapian at tartarus.org
Thu Sep 30 09:21:33 BST 2004
On Wed, Sep 29, 2004 at 01:43:44PM -0600, gervin23 wrote:
> >The Python bindings as they stand can't do this - it's a nasty problem
> >to do with SWIG not coping with extension overloaded constructors. I'm
> >not quite sure how to fix it properly, so I'm working on a workaround
> >that would allow you to build queries out of lists of strings with a
> >single operator.
>
> sounds like a more pythonic way of doing it.
> would i be able to build complex queries (i.e. phrases mixed with
> booleans)?
Yes - I /think/ that only phrase searches (PHRASE/NEAR) require you to
be able to use more than two terms in a query constructor. (Is this
right? It may be more efficient, but I don't think it changes the
expressability ...) Complex queries are trees - so you can construct
the tree explicitly by building bits of the tree individually and
glueing them together.
> if there were a way to send a string exactly like what get_description()
> returns, i'd be good to go. for example, using queryparser() for
> "golfing at two" returns 'Xapian::Query((golfing:(pos=1) PHRASE 3
> at:(pos=2) PHRASE 3 two:(pos=3)))'. i would have no problem building
> this (or the inner portion of it) as a string if there were a way to
> send it directly to enquire.set_query()
That would be an interesting extension, equivalent to the query parser
but a good deal more powerful. I don't know exactly what the grammar
of get_description() is, but I doubt it would be all that difficult to
do ...
James
--
/--------------------------------------------------------------------------\
James Aylett xapian.org
james at tartarus.org uncertaintydivision.org
More information about the Xapian-discuss
mailing list