0
votes

I'm using Xapian in my Python code, and when I use:

queryparser = xapian.QueryParser()

the object is inicialized with many flags: FLAG_BOOLEAN, FLAG_SPEALLING_CORRECTION. I want to know how can I change this flag. I found in documentation what each one do but not how to change.

1

1 Answers

0
votes

You seem to have found the API documentation for QueryParser, which is where the various flags are documented (hopefully the link will be helpful to others finding this question).

You can set the flags when you call the parse_query() method of a QueryParser object, such as:

import xapian queryparser = xapian.QueryParser() query = queryparser.parse_query( "my query", queryparser.FLAG_BOOLEAN | queryparser.FLAG_WILDCARD )

(You can also use xapian.QueryParser.FLAG_BOOLEAN and similar, but this is more verbose.)

As the example shows, you use Python's bitwise or operator to combine the different flags you need. The use of bitwise or is covered in the API documentation for the QueryParser.parse_query() method, which you can access from the Python REPL by using help(xapian.QueryParser.parse_query).