lib: leave stemmer object accessible

This enables using the same stemmer in both query parsers.
This commit is contained in:
David Bremner 2021-08-24 08:17:17 -07:00
parent be7e83de96
commit 3202e0d1fe
2 changed files with 3 additions and 1 deletions

View file

@ -232,6 +232,7 @@ struct _notmuch_database {
*/ */
unsigned long view; unsigned long view;
Xapian::QueryParser *query_parser; Xapian::QueryParser *query_parser;
Xapian::Stem *stemmer;
Xapian::TermGenerator *term_gen; Xapian::TermGenerator *term_gen;
Xapian::RangeProcessor *value_range_processor; Xapian::RangeProcessor *value_range_processor;
Xapian::RangeProcessor *date_range_processor; Xapian::RangeProcessor *date_range_processor;

View file

@ -432,7 +432,8 @@ _finish_open (notmuch_database_t *notmuch,
"lastmod:"); "lastmod:");
notmuch->query_parser->set_default_op (Xapian::Query::OP_AND); notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
notmuch->query_parser->set_database (*notmuch->xapian_db); notmuch->query_parser->set_database (*notmuch->xapian_db);
notmuch->query_parser->set_stemmer (Xapian::Stem ("english")); notmuch->stemmer = new Xapian::Stem ("english");
notmuch->query_parser->set_stemmer (*notmuch->stemmer);
notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME); notmuch->query_parser->set_stemming_strategy (Xapian::QueryParser::STEM_SOME);
notmuch->query_parser->add_rangeprocessor (notmuch->value_range_processor); notmuch->query_parser->add_rangeprocessor (notmuch->value_range_processor);
notmuch->query_parser->add_rangeprocessor (notmuch->date_range_processor); notmuch->query_parser->add_rangeprocessor (notmuch->date_range_processor);