Search::Xapian::QueryParser - Parse a query string into a Search::Xapian::Query object
This module turns a human readable string into something Xapian can understand. The syntax supported is designed to be similar to other web based search engines, so that users familiar with them don't have to learn a whole new syntax.
use Search::Xapian qw/:standard/;
my $qp = new Search::Xapian::QueryParser( [$database] );
$qp->set_stemmer(new Search::Xapian::Stem("english"));
$qp->set_default_op(OP_AND);
$database->enquire($qp->parse_query('a NEAR word OR "a phrase" NOT (too difficult) +eh'));
STEM_ALL, STEM_SOME,
STEM_NONE.
FLAG_BOOLEAN, FLAG_PHRASE, FLAG_LOVEHATE, FLAG_BOOLEAN_ANY_CASE, FLAG_WILDCARD, FLAG_PURE_NOT, FLAG_PARTIAL
To specify multiple flags, ``or'' them together (with |). The
default flags are FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE
Allows the user to search for author:orwell which will search for the term ``Aorwel'' (assuming English stemming is in use). Multiple fields can be mapped to the same prefix (so you can e.g. make title: and subject: aliases for each other).
| Parameters: | |
| field | The user visible field name |
| prefix | The term prefix to map this to |
$p->add_boolean_prefix("site", "H");
Allows the user to restrict a search with site:xapian.org which will be
converted to Hxapian.org combined with any probabilistic query with
OP_FILTER.
Multiple fields can be mapped to the same prefix (so you can e.g. make site: and domain: aliases for each other).
| Parameters: | |
| field | The user visible field name |
| prefix | The term prefix to map this to |
http://www.xapian.org/docs/queryparser.html http://www.xapian.org/docs/sourcedoc/html/classXapian_1_1QueryParser.html