[Xapian-discuss] Using QueryParser results to populate UI

Matt Goodall matt.goodall at gmail.com
Sun Jun 6 11:30:43 BST 2010


On 6 June 2010 11:23, Matt Goodall <matt.goodall at gmail.com> wrote:
> Hi,
>
> I would like to "pull apart" a search string to populate distinct
> search fields in a UI; something like how Google toggles between
> simple and advanced search modes. I realise going from simple to
> advanced may well be lossy but that's fine for my purposes.
>
> I thought the obvious place to start was xapian's QueryParser.
> Unfortunately, Query instances appear to be a little opaque, at least
> from the Python bindings. Am I missing something obvious or will I
> need my own xapian-like query parser to do what I want?

Incidentally, if anyone has already written a query parser in Python
that I can use then I'd be extremely grateful! I need to support:

  * word and phrase terms
  * AND, implicit, e.g. "one two", and explicit, e.g. "one AND two"
  * OR
  * NOT, -expr prefix and/or NOT expr
  * bracketed expressions
  * field prefixed searches, e.g. title:"xapian"

I've actually got something using pyparsing fairly close but I'm
having trouble making it support implicit AND at the moment.

- Matt



More information about the Xapian-discuss mailing list