| Top |
| XapianDatabase * | database | Read / Write |
| XapianQueryOp | default-op | Read / Write |
| XapianStem * | stemmer | Read / Write |
| XapianStemStrategy | stemming-strategy | Read / Write |
| XapianStopper * | stopper | Read / Write |
GEnum ╰── XapianStemStrategy GFlags ╰── XapianQueryParserFeature GObject ╰── XapianQueryParser
XapianQueryParser is a class that can parse a query string and generate a XapianQuery instance from it.
XapianQueryParser can use a XapianStem to isolate the terms for the query, as well as use a database for wildcard expansion.
XapianQueryParser *
xapian_query_parser_new (void);
Creates a new XapianQueryParser.
void xapian_query_parser_set_stemmer (XapianQueryParser *parser,XapianStem *stemmer);
Sets the stemmer for parser
.
char *
xapian_query_parser_get_corrected_query_string
(XapianQueryParser *parser);
Get the spelling-corrected query string.
This will only be set if XAPIAN_QUERY_PARSER_FEATURE_SPELLING_CORRECTION
is specified when xapian_query_parser_parse_query_full() was last called.
If there were no corrections, an empty string is returned.
Since: 1.2
XapianStopper *
xapian_query_parser_get_stopper (XapianQueryParser *parser);
Retrieves the stopper set using xapian_query_parser_set_stopper().
Since: 1.2
void xapian_query_parser_set_stemming_strategy (XapianQueryParser *parser,XapianStemStrategy strategy);
Sets the stemming strategy
for parser
.
The stemming strategy is only used if parser
uses a stemmer.
void xapian_query_parser_set_database (XapianQueryParser *parser,XapianDatabase *database);
Sets the database
used by parser
for wildcard expansion.
void xapian_query_parser_set_stopper (XapianQueryParser *parser,XapianStopper *stopper);
Sets the stopper
used by parser
stop word elimination.
Since: 1.2
void xapian_query_parser_set_default_op (XapianQueryParser *parser,XapianQueryOp op);
Set the operator to use to combine non-filter query items when no explicit operator is used.
Since: 1.4
void xapian_query_parser_add_prefix (XapianQueryParser *parser,const char *field,const char *prefix);
Adds a probabilistic term prefix.
For instance, calling:
1 |
xapian_query_parser_add_prefix (parser, "author", "A"); |
allows the user to search for author:Orwell, which will be
converted to a search for Aorwell.
It is possible to map multiple fields to the same prefix, for
instance title and subject.
It is possible to map the same field to multiple prefixes; the generated query will perform an OR operation on each term.
void xapian_query_parser_add_boolean_prefix (XapianQueryParser *parser,const char *field,const char *prefix,gboolean exclusive);
Adds a boolean term prefix to the query.
parser |
||
field |
the user visible field name |
|
prefix |
the term prefix to map the |
|
exclusive |
if |
XapianQuery * xapian_query_parser_parse_query (XapianQueryParser *parser,const char *query_string,GError **error);
Parses a query string and generates a XapianQuery instance for it.
See also: xapian_query_parser_parse_query_full()
XapianQuery * xapian_query_parser_parse_query_full (XapianQueryParser *parser,const char *query_string,XapianQueryParserFeature flags,const char *default_prefix,GError **error);
Parses query_string
and creates a XapianQuery instance for it.
parser |
||
query_string |
the query string |
|
flags |
a bitwise OR of XapianQueryParserFeature values |
|
default_prefix |
the default prefix for terms |
|
error |
return location for a GError |
Flags for xapian_query_parser_parse_query_full().
|
support AND, OR, etc as well as bracketed subexpressions |
||
|
support quoted phrases |
||
|
support |
||
|
support AND, OR, etc. even if not in upper case |
||
|
support right truncation,
e.g. |
||
|
allow queries such as |
||
|
enable partial matching |
||
|
enable spelling correction |
||
|
enable synonym operator |
||
|
enable automatic use of synonyms for single terms |
||
|
enable automatic use of synonyms for single terms and groups of terms |
||
|
enable generation of n-grams from CJK text (Since: 1.4.0) |
||
|
default flags |
“database” property“database” XapianDatabase *
The XapianDatabase to be used for wildcard expansion.
Flags: Read / Write
“default-op” property“default-op” XapianQueryOp
The query operator used to combine non-filter query items when no explicit operator is used.
Flags: Read / Write
Default value: XAPIAN_QUERY_OP_OR
“stemmer” property“stemmer” XapianStem *
The XapianStem instance to be used for stemming the query string.
Flags: Read / Write
“stemming-strategy” property“stemming-strategy” XapianStemStrategy
The stemming strategy to use with the XapianStem set with the “stemmer” property.
Flags: Read / Write
Default value: XAPIAN_STEM_STRATEGY_STEM_NONE
“stopper” property“stopper” XapianStopper *
The XapianStopper to be used for dropping stop words
Flags: Read / Write
Since: 1.2