Xapian::QueryParser Class Reference

Build a Xapian::Query object from a user query string. More...

`#include <queryparser.h>`

## Public Types

enum

feature_flag {
FLAG_BOOLEAN = 1 , FLAG_PHRASE = 2 , FLAG_LOVEHATE = 4 , FLAG_BOOLEAN_ANY_CASE = 8 ,
FLAG_WILDCARD = 16 , FLAG_PURE_NOT = 32 , FLAG_PARTIAL = 64 , FLAG_SPELLING_CORRECTION = 128 ,
FLAG_SYNONYM = 256 , FLAG_AUTO_SYNONYMS = 512 , FLAG_AUTO_MULTIWORD_SYNONYMS = 1024 , FLAG_NGRAMS = 2048 ,
FLAG_CJK_NGRAM = FLAG_NGRAMS , FLAG_WORD_BREAKS = 4096 , FLAG_WILDCARD_MULTI = 8192 , FLAG_WILDCARD_SINGLE = 16384 ,
FLAG_WILDCARD_GLOB = FLAG_WILDCARD_MULTI | FLAG_WILDCARD_SINGLE , FLAG_FUZZY = 32768 , FLAG_ACCUMULATE = 65536 , FLAG_NO_POSITIONS = 0x20000 ,
FLAG_NO_PROPER_NOUN_HEURISTIC = 0x40000 , FLAG_DEFAULT = FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE
}

| Enum of feature flags. More...
enum | stem_strategy { STEM_NONE , STEM_SOME , STEM_ALL , STEM_ALL_Z , STEM_SOME_FULL_POS }
| Stemming strategies, for use with set_stemming_strategy().
enum | stop_strategy { STOP_NONE , STOP_ALL , STOP_STEMMED }
| Stopper strategies, for use with set_stopper_strategy(). More...

## Public Member Functions

| QueryParser (const QueryParser &o)
| Copy constructor.
QueryParser & | operator= (const QueryParser &o)
| Assignment.
| QueryParser (QueryParser &&o)
| Move constructor.
QueryParser & | operator= (QueryParser &&o)
| Move assignment operator.
| QueryParser ()
| Default constructor.
| ~QueryParser ()
| Destructor.
void | set_stemmer (const Xapian::Stem &stemmer)
| Set the stemmer.
void | set_stemming_strategy (stem_strategy strategy)
| Set the stemming strategy.
void | set_stopper (const Stopper *stop=NULL)
| Set the stopper.
void | set_stopper_strategy (stop_strategy strategy)
| Set the stopper strategy.
void | set_default_op (Query::op default_op)
| Set the default operator.
Query::op | get_default_op () const
| Get the current default operator.
void | set_database (const Database &db)
| Specify the database being searched.
void | set_max_expansion (Xapian::termcount max_expansion, int max_type=Xapian::Query::WILDCARD_LIMIT_ERROR, unsigned flags=FLAG_WILDCARD|FLAG_PARTIAL|FLAG_FUZZY)
| Specify the maximum expansion of a wildcard and/or partial and/or fuzzy term.
void | set_min_wildcard_prefix (unsigned min_prefix_len, unsigned flags=FLAG_WILDCARD|FLAG_PARTIAL)
| Specify minimum length for fixed initial portion in wildcard patterns.
Query | parse_query (std::string_view query_string, unsigned flags=FLAG_DEFAULT, std::string_view default_prefix={})
| Parse a query.
void | add_prefix (std::string_view field, std::string_view prefix)
| Add a free-text field term prefix.
void | add_prefix (std::string_view field, Xapian::FieldProcessor *proc)
| Register a FieldProcessor.
void | add_boolean_prefix (std::string_view field, std::string_view prefix, const std::string *grouping=NULL)
| Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query.
void | add_boolean_prefix (std::string_view field, std::string_view prefix, bool exclusive)
| Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query.
void | add_boolean_prefix (std::string_view field, Xapian::FieldProcessor *proc, const std::string *grouping=NULL)
| Register a FieldProcessor for a boolean prefix.
void | add_boolean_prefix (std::string_view field, Xapian::FieldProcessor *proc, bool exclusive)
| Register a FieldProcessor for a boolean prefix.
TermIterator | stoplist_begin () const
| Begin iterator over terms omitted from the query as stopwords.
TermIterator | stoplist_end () const noexcept
| End iterator over terms omitted from the query as stopwords.
TermIterator | unstem_begin (std::string_view term) const
| Begin iterator over unstemmed forms of the given stemmed query term.
TermIterator | unstem_end (std::string_view) const noexcept
| End iterator over unstemmed forms of the given stemmed query term.
void | add_rangeprocessor (Xapian::RangeProcessor *range_proc, const std::string *grouping=NULL)
| Register a RangeProcessor.
std::string | get_corrected_query_string () const
| Get the spelling-corrected query string.
std::string | get_description () const
| Return a string describing this object.

## Detailed Description

Build a Xapian::Query object from a user query string.

## Member Enumeration Documentation

## feature_flag

enum Xapian::QueryParser::feature_flag

Enum of feature flags.

Enumerator
FLAG_BOOLEAN | Support AND, OR, etc and bracketed subexpressions.
FLAG_PHRASE | Support quoted phrases.
FLAG_LOVEHATE | Support + and -.
FLAG_BOOLEAN_ANY_CASE | Support AND, OR, etc even if they aren't in ALLCAPS.

FLAG_WILDCARD

Support wildcards.

This flag only enables support for right truncation (e.g. Xap*) - see FLAG_WILDCARD_MULTI, FLAG_WILDCARD_SINGLE and FLAG_WILDCARD_GLOB for extended wildcard support.

Currently you can't use wildcards with boolean filter prefixes, or in a phrase (either an explicitly quoted one, or one implicitly generated by hyphens or other punctuation).

In Xapian 1.2.x, you needed to tell the QueryParser object which database to expand wildcards from by calling set_database(). In Xapian 1.3.3, OP_WILDCARD was added and wildcards are now expanded when Enquire::get_mset() is called, with the expansion using the database being searched.

FLAG_PURE_NOT | Allow queries such as 'NOT apples'. These require the use of a list of all documents in the database which is potentially expensive, so this feature isn't enabled by default.

FLAG_PARTIAL

Enable partial matching.

Partial matching causes the parser to treat the query as a "partially entered" search. This will automatically treat the final word as a wildcarded match, unless it is followed by whitespace, to produce more stable results from interactive searches.

Currently FLAG_PARTIAL doesn't do anything if the final word in the query has a boolean filter prefix, or if it is in a phrase (either an explicitly quoted one, or one implicitly generated by hyphens or other punctuation). It also doesn't do anything if if the final word is part of a value range.

In Xapian 1.2.x, you needed to tell the QueryParser object which database to expand wildcards from by calling set_database(). In Xapian 1.3.3, OP_WILDCARD was added and wildcards are now expanded when Enquire::get_mset() is called, with the expansion using the database being searched.

FLAG_SPELLING_CORRECTION

Enable spelling correction.

For each word in the query which doesn't exist as a term in the database, Database::get_spelling_suggestion() will be called and if a suggestion is returned, a corrected version of the query string will be built up which can be read using QueryParser::get_corrected_query_string(). The query returned is based on the uncorrected query string however - if you want a parsed query based on the corrected query string, you must call QueryParser::parse_query() again.

NB: You must also call set_database() for this to work.

FLAG_SYNONYM | Enable synonym operator '~'. NB: You must also call set_database() for this to work.
FLAG_AUTO_SYNONYMS | Enable automatic use of synonyms for single terms. NB: You must also call set_database() for this to work.
FLAG_AUTO_MULTIWORD_SYNONYMS | Enable automatic use of synonyms for single terms and groups of terms. NB: You must also call set_database() for this to work.

FLAG_NGRAMS

Generate n-grams for scripts without explicit word breaks.

Spans of characters in such scripts are split into unigrams and bigrams, with the unigrams carrying positional information. Text in other scripts is split into words as normal.

The TermGenerator::FLAG_NGRAMS flag needs to have been used at index time.

This mode can also be enabled in 1.2.8 and later by setting environment variable XAPIAN_CJK_NGRAM to a non-empty value (but doing so was deprecated in 1.4.11).

In 1.4.x this feature was specific to CJK (Chinese, Japanese and Korean), but in 2.0.0 it's been extended to other languages. To reflect this change the new and preferred name is FLAG_NGRAMS, which was added as an alias for forward compatibility in Xapian 1.4.23. Use FLAG_CJK_NGRAM instead if you aim to support Xapian < 1.4.23.

Since
  Added in Xapian 1.4.23.

FLAG_CJK_NGRAM

Generate n-grams for scripts without explicit word breaks.

Old name - use FLAG_NGRAMS instead unless you aim to support Xapian < 1.4.23.

Since
  Added in Xapian 1.3.4 and 1.2.22.

FLAG_WORD_BREAKS

Find word breaks for text in scripts without explicit word breaks.

With this option enabled, spans of text written in such scripts are split into words using ICU (which uses heuristics and/or dictionaries to do so). Text in other scripts is split into words as normal.

The TermGenerator::FLAG_WORD_BREAKS flag needs to have been used at index time.

Since
  Added in Xapian 2.0.0.

FLAG_WILDCARD_MULTI

Support extended wildcard '*'.

This flag enables support for wildcard '*' matching zero or more characters, which may be used anywhere in a word.

Such wildcards can be relatively expensive to expand and to match so benchmark your system carefully if you have a lot of documents and/or a high search load.

FLAG_WILDCARD is ignored if this flag is specified.

Since
  Added in Xapian 2.0.0.

FLAG_WILDCARD_SINGLE

Support extended wildcard '?

'.

This flag enables support for wildcard '?' matching exactly one character, which may be use anywhere in a word.

Such wildcards can be relatively expensive to expand and to match so benchmark your system carefully if you have a lot of documents and/or a high search load.

FLAG_WILDCARD is ignored if this flag is specified.

Since
  Added in Xapian 2.0.0.

FLAG_WILDCARD_GLOB

Enable glob-style wildcarding.

This enables all supported glob-style wildcard pattern flags

- currently that's FLAG_WILDCARD_MULTI and FLAG_WILDCARD_SINGLE.

FLAG_WILDCARD is ignored if this flag is specified.

Since
  Added in Xapian 2.0.0.

FLAG_FUZZY

Support fuzzy matching.

E.g. "unserten~3" would expand to "uncertain" (and likely other terms).

foo~ uses edit distance of 2 since~0.2 uses edit distance of length("since") * 0.2 = 5 * 0.2 = 1

Since
  Added in Xapian 2.0.0.

FLAG_ACCUMULATE

Accumulate unstem and stoplist results.

By default, the unstem and stoplist data is reset by a call to parse_query(), which makes sense if you use the same QueryParser object to parse a series of independent queries.

If you're using the same QueryParser object to parse several fields on the same query form, you may want to have the unstem and stoplist data combined for all of them, in which case you can use this flag to prevent this data from being reset.

Since
  Added in Xapian 1.4.18.

FLAG_NO_POSITIONS

Produce a query which doesn't use positional information.

With this flag enabled, no positional information will be used and any query operations which would use it are replaced by the nearest equivalent which doesn't (so phrase searches, NEAR and ADJ will result in OP_AND).

Since
  Added in Xapian 1.4.19.

FLAG_NO_PROPER_NOUN_HEURISTIC

Turn off special handling of capitalised words.

By default capitalising a word prevents it from being considered for stemming. This only has any effect when both stemmed and non-stemmed terms are available (i.e. when stem_strategy is the default STEM_SOME or STEM_SOME_FULL_POS), and since Xapian 2.0.0 it is only done for languages where it is helpful.

This attempts to limit problems which stemming can cause with proper names. For example, the English stemmer conflates Tony with Toni and Keats with Keating, which can lead to unwanted matches with irrelevant documents.

One downside is it prevents stemming of words that aren't proper nouns but are capitalised for other reasons (e.g. in a title or at the start of a sentence).

Another is that proper nouns can be inflected in some languages. In English some can be pluralised ("How many Tonys do you know?"), and in some languages proper nouns can take an -s suffix to indicate the genitive case (e.g. "Köpenhamns" in Swedish is like "Copenhagen's" in English).

If inflection is limited to plurals and genitive-s, the benefits of this special handling still seem to outweigh the downsides. However for languages with more extensive inflection of proper nouns it seems too problematic so (since Xapian 2.0.0) we don't enable it for such languages. It's also off for German where all nouns are capitalised (not just proper nouns).

This special handling is also only useful in languages where proper nouns are capitalised (so for example, it's not useful for languages written in alphabets without upper case).

Since
  FLAG_NO_PROPER_NOUN_HEURISTIC was added in Xapian 2.0.0.

FLAG_DEFAULT

The default flags.

Used if you don't explicitly pass any to parse_query(). The default flags are FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE.

Since
  Added in Xapian 1.0.11.

## stop_strategy

enum Xapian::QueryParser::stop_strategy

Stopper strategies, for use with set_stopper_strategy().

Since
  Added in Xapian 2.0.0.

## Member Function Documentation

## add_boolean_prefix() [1/3]

void Xapian::QueryParser::add_boolean_prefix | ( | std::string_view | field,
|  | std::string_view | prefix,
|  | bool | exclusive )

inline

Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query.

This is an older version of this method - use the version with the grouping parameter in preference to this one.

Parameters

  field | The user visible field name, which may not be empty for a boolean filter. Currently this needs to consist of characters for which Xapian::Unicode::is_wordchar() is true (approximately alphanumerics plus connector punctuation such as _). Since 1.4.26 it can optionally end in a : for consistency with how range prefixes are specified.
  prefix | The term prefix to map this to
  exclusive | Controls how multiple filters are combined. If true then prefix is used as the grouping value, so terms with the same prefix are combined with OP_OR, then the resulting queries are combined with OP_AND. If false, then a unique grouping is created for each filter (this is sometimes useful when each document can have multiple terms with this prefix).

References add_boolean_prefix().

## add_boolean_prefix() [2/3]

void Xapian::QueryParser::add_boolean_prefix | ( | std::string_view | field,
|  | std::string_view | prefix,
|  | const std::string * | grouping = NULL )

Add a boolean term prefix allowing the user to restrict a search with a boolean filter specified in the free text query.

For example:

qp.add_boolean_prefix("site", "H");

This allows the user to restrict a search with site:xapian.org which will be converted to Hxapian.org combined with any weighted query with `Xapian::Query::OP_FILTER`.

If multiple boolean filters are specified in a query for the same prefix, they will be combined with the `Xapian::Query::OP_OR` operator. Then, if there are boolean filters for different prefixes, they will be combined with the `Xapian::Query::OP_AND` operator.

Multiple fields can be mapped to the same prefix (so for example you can make site: and domain: aliases for each other). Instances of fields with different aliases but the same prefix will still be combined with the OR operator.

For example, if "site" and "domain" map to "H", but author maps to "A", a search for "site:foo domain:bar author:Fred" will map to "(Hfoo OR Hbar) AND Afred".

As of 1.0.4, you can call this method multiple times with the same value of field to allow a single field to be mapped to multiple prefixes. Multiple terms being generated for such a field, and combined with `Xapian::Query::OP_OR`.

Calling this method with an empty string for field will cause a `Xapian::InvalidArgumentError`.

If you call `add_prefix()` and `add_boolean_prefix()` for the same value of field, a `Xapian::InvalidOperationError` exception will be thrown.

In 1.0.3 and earlier, subsequent calls to this method with the same value of field had no effect.

Parameters

  field | The user visible field name, which may not be empty for a boolean filter. Currently this needs to consist of characters for which Xapian::Unicode::is_wordchar() is true (approximately alphanumerics plus connector punctuation such as _). Since 1.4.26 it can optionally end in a : for consistency with how range prefixes are specified.
  prefix | The term prefix to map this to
  grouping | Controls how multiple filters are combined - filters with the same grouping value are combined with OP_OR, then the resulting queries are combined with OP_AND. If NULL, then field is used for grouping. If an empty string, then a unique grouping is created for each filter (this is sometimes useful when each document can have multiple terms with this prefix). [default: NULL]

Referenced by add_boolean_prefix(), and add_boolean_prefix().

## add_boolean_prefix() [3/3]

void Xapian::QueryParser::add_boolean_prefix | ( | std::string_view | field,
|  | Xapian::FieldProcessor * | proc,
|  | bool | exclusive )

inline

Register a FieldProcessor for a boolean prefix.

This is an older version of this method - use the version with the grouping parameter in preference to this one.

References add_boolean_prefix().

## add_prefix()

void Xapian::QueryParser::add_prefix | ( | std::string_view | field,
|  | std::string_view | prefix )

Add a free-text field term prefix.

For example:

qp.add_prefix("author", "A");

This allows the user to search for author:Orwell which will be converted to a search for the term "Aorwell".

Multiple fields can be mapped to the same prefix. For example, you can make title: and subject: aliases for each other.

As of 1.0.4, you can call this method multiple times with the same value of field to allow a single field to be mapped to multiple prefixes. Multiple terms being generated for such a field, and combined with `Xapian::Query::OP_OR`.

If any prefixes are specified for the empty field name (i.e. you call this method with an empty string as the first parameter) these prefixes will be used for terms without a field specifier. If you do this and also specify the `default_prefix` parameter to `parse_query()`, then the `default_prefix` parameter will override.

If the prefix parameter is empty, then "field:word" will produce the term "word" (and this can be one of several prefixes for a particular field, or for terms without a field specifier).

If you call `add_prefix()` and `add_boolean_prefix()` for the same value of field, a `Xapian::InvalidOperationError` exception will be thrown.

In 1.0.3 and earlier, subsequent calls to this method with the same value of field had no effect.

Parameters

  field | The user visible field name. Currently this needs to consist of characters for which Xapian::Unicode::is_wordchar() is true (approximately alphanumerics plus connector punctuation such as _). Since 1.4.26 it can optionally end in a : for consistency with how range prefixes are specified.
  prefix | The term prefix to map this to.

## get_corrected_query_string()

std::string Xapian::QueryParser::get_corrected_query_string | ( |  | ) | const

Get the spelling-corrected query string.

This will only be set if FLAG_SPELLING_CORRECTION is specified when QueryParser::parse_query() was last called.

If there were no corrections, an empty string is returned.

## parse_query()

Query Xapian::QueryParser::parse_query | ( | std::string_view | query_string,
|  | unsigned | flags = FLAG_DEFAULT,
|  | std::string_view | default_prefix = {} )

Parse a query.

Parameters

  query_string | A free-text query as entered by a user
  flags | Zero or more QueryParser::feature_flag specifying what features the QueryParser should support. Combine multiple values with bitwise-or (|) (default FLAG_DEFAULT).
  default_prefix | The default term prefix to use (default none). For example, you can pass "A" when parsing an "Author" field.

Exceptions

  If | the query string can't be parsed, then Xapian::QueryParserError is thrown. You can get an English error message to report to the user by catching it and calling get_msg() on the caught exception. The current possible values (in case you want to translate them) are:

- Unknown range operation
- parse error
- Syntax: <expression> AND <expression>
- Syntax: <expression> AND NOT <expression>
- Syntax: <expression> NOT <expression>
- Syntax: <expression> OR <expression>
- Syntax: <expression> XOR <expression>

References FLAG_DEFAULT.

## set_database()

void Xapian::QueryParser::set_database | ( | const Database & | db | ) |

Specify the database being searched.

Parameters

  db | The database to use for spelling correction (FLAG_SPELLING_CORRECTION), and synonyms (FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and FLAG_AUTO_MULTIWORD_SYNONYMS).

## set_default_op()

void Xapian::QueryParser::set_default_op | ( | Query::op | default_op | ) |

Set the default operator.

Parameters

  default_op | The operator to use to combine non-filter query items when no explicit operator is used.

So for example, 'weather forecast' is parsed as if it were 'weather OR forecast' by default.

The most useful values for this are OP_OR (the default) and OP_AND. OP_NEAR, OP_PHRASE, OP_ELITE_SET, OP_SYNONYM and OP_MAX are also permitted. Passing other values will result in InvalidArgumentError being thrown.

## set_max_expansion()

void Xapian::QueryParser::set_max_expansion | ( | Xapian::termcount | max_expansion,
|  | int | max_type = Xapian::Query::WILDCARD_LIMIT_ERROR,
|  | unsigned | flags = FLAG_WILDCARD|FLAG_PARTIAL|FLAG_FUZZY )

Specify the maximum expansion of a wildcard and/or partial and/or fuzzy term.

Note: you must also set FLAG_WILDCARD and/or FLAG_PARTIAL and/or FLAG_FUZZY in the flags parameter to parse_query() for this setting to have anything to affect.

If you don't call this method, the default settings are no limit on wildcard and fuzzy expansion, and partial terms expanding to the most frequent 100 terms - i.e. as if you'd called:

set_max_expansion(0); set_max_expansion(100, Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT, Xapian::QueryParser::FLAG_PARTIAL);

Parameters

  max_expansion | The maximum number of terms each wildcard in the query can expand to, or 0 for no limit (which is the default).
  max_type | Xapian::Query::WILDCARD_LIMIT_ERROR, Xapian::Query::WILDCARD_LIMIT_FIRST or Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT (default: Xapian::Query::WILDCARD_LIMIT_ERROR).
  flags | What to set the limit for (default: FLAG_WILDCARD|FLAG_PARTIAL|FLAG_FUZZY, setting the limit for all types).

Since
  1.3.3

References FLAG_FUZZY, FLAG_PARTIAL, FLAG_WILDCARD, and Xapian::Query::WILDCARD_LIMIT_ERROR.

## set_min_wildcard_prefix()

void Xapian::QueryParser::set_min_wildcard_prefix | ( | unsigned | min_prefix_len,
|  | unsigned | flags = FLAG_WILDCARD|FLAG_PARTIAL )

Specify minimum length for fixed initial portion in wildcard patterns.

It can be desirable for performance reasons to restrict use of wildcards to patterns with a fixed initial portion, so this method provides a way to specify a minimum length. A wildcard pattern with a shorter (or no) fixed initial portion will result in Xapian::QueryParser being thrown. The default minimum length is 0.

It also provides a way to specify the minimum length of a word to expand for partial matching (see FLAG_PARTIAL). In this case a shorter word at the end of the query simply result in no partial matching. The default minimum length for this case is 2 (since 2.0.0 - in earlier versions it was effectively 0).

Parameters

  min_prefix_len | Minimum length of fixed initial portion in Unicode characters.
  flags | What to set the minimum length for (default: FLAG_WILDCARD|FLAG_PARTIAL, setting the limit for both wildcards and partial terms).

Since
  Added in Xapian 2.0.0.

References FLAG_PARTIAL, and FLAG_WILDCARD.

## set_stemmer()

void Xapian::QueryParser::set_stemmer | ( | const Xapian::Stem & | stemmer | ) |

Set the stemmer.

This sets the stemming algorithm which will be used by the query parser. The stemming algorithm will be used according to the stemming strategy set by set_stemming_strategy(). As of 1.3.1, this defaults to STEM_SOME, but in earlier versions the default was STEM_NONE. If you want to work with older versions, you should explicitly set a stemming strategy as well as setting a stemmer, otherwise your stemmer won't actually be used.

Parameters

  stemmer | The Xapian::Stem object to set.

## set_stemming_strategy()

void Xapian::QueryParser::set_stemming_strategy | ( | stem_strategy | strategy | ) |

Set the stemming strategy.

This controls how the query parser will apply the stemming algorithm. Note that the stemming algorithm is only applied to words in free-text fields - boolean filter terms are never stemmed.

Parameters

  strategy

  The strategy to use - possible values are:
  - STEM_NONE: Don't perform any stemming. (default in Xapian <= 1.3.0)
  - STEM_SOME: Stem all terms except for those which start with a capital letter, or are followed by certain characters (currently: `(/@<>=*[{"` ), or are used with operators which need positional information. Stemmed terms are prefixed with 'Z'. (default in Xapian >= 1.3.1)
  - STEM_SOME_FULL_POS: Like STEM_SOME but also stems terms used with operators which need positional information. Added in Xapian 1.4.8.
  - STEM_ALL: Stem all terms (note: no 'Z' prefix is added).
  - STEM_ALL_Z: Stem all terms (note: 'Z' prefix is added). (new in Xapian 1.2.11 and 1.3.1)

## set_stopper()

void Xapian::QueryParser::set_stopper | ( | const Stopper * | stop = NULL | ) |

Set the stopper.

Parameters

  stop | The Stopper object to set (default NULL, which means no stopwords).

## set_stopper_strategy()

void Xapian::QueryParser::set_stopper_strategy | ( | stop_strategy | strategy | ) |

Set the stopper strategy.

This method controls how the stopper is used.

You need to also call set_stopper() for this to have any effect.

Parameters

  strategy

  The strategy to use - possible values are:
  - STOP_NONE: Don't use the stopper.
  - STOP_ALL: If a word is identified as a stop word, skip it completely. This makes some queries less useful (e.g. "to be or not to be that is the question" would become a search for just question if the other words were all stopwords). If you index with STOP_ALL you should use it when parsing queries too.
  - STOP_STEMMED: If a word is identified as a stop word, assume it was still indexed unstemmed and don't treat it as a stopword in contexts where we would use the unstemmed form (for example, phrase searches, ADJ, NEAR). (This is the default mode).

Since
  Added in Xapian 2.0.0.

The documentation for this class was generated from the following file:

- xapian/queryparser.h