lib: rename support-ngrams => ngrams-enabled
For consistency.
This commit is contained in:
@ -79,7 +79,7 @@ make_term_generator(Xapian::Document& doc, Document::Options opts)
|
||||
{
|
||||
Xapian::TermGenerator termgen;
|
||||
|
||||
if (any_of(opts & Document::Options::SupportNgrams))
|
||||
if (any_of(opts & Document::Options::NgramsEnabled))
|
||||
termgen.set_flags(Xapian::TermGenerator::FLAG_NGRAMS);
|
||||
|
||||
termgen.set_document(doc);
|
||||
|
||||
@ -43,7 +43,7 @@ class Document {
|
||||
public:
|
||||
enum struct Options {
|
||||
None = 0,
|
||||
SupportNgrams = 1 << 0, /**< Support ngrams, as used in
|
||||
NgramsEnabled = 1 << 0, /**< Support ngrams, as used in
|
||||
* CJK and other languages. */
|
||||
};
|
||||
|
||||
|
||||
@ -78,8 +78,8 @@ struct Message::Private {
|
||||
|
||||
private:
|
||||
Document::Options doc_opts(Message::Options mopts) {
|
||||
return any_of(opts & Message::Options::SupportNgrams) ?
|
||||
Document::Options::SupportNgrams :
|
||||
return any_of(opts & Message::Options::NgramsEnabled) ?
|
||||
Document::Options::NgramsEnabled :
|
||||
Document::Options::None;
|
||||
}
|
||||
};
|
||||
|
||||
@ -52,7 +52,7 @@ public:
|
||||
* access) */
|
||||
AllowRelativePath = 1 << 2, /**< Allow relative paths for filename
|
||||
* in make_from_path */
|
||||
SupportNgrams = 1 << 3, /**< Support ngrams, as used in
|
||||
NgramsEnabled = 1 << 3, /**< Support ngrams, as used in
|
||||
* CJK and other languages. */
|
||||
};
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ Sexp parse_query(const std::string& expr, bool expand=false);
|
||||
*/
|
||||
enum struct ParserFlags {
|
||||
None = 0 << 0,
|
||||
SupportNgrams = 1 << 0, /**< Support Xapian's Ngrams for CJK etc. handling */
|
||||
NgramsEnabled = 1 << 0, /**< Support Xapian's Ngrams for CJK etc. handling */
|
||||
XapianParser = 1 << 1, /**< For testing only, use Xapian's
|
||||
* built-in QueryParser; this is not
|
||||
* fully compatible with mu, only useful
|
||||
|
||||
@ -256,7 +256,7 @@ parse_field_matcher(const Store& store, const Field& field,
|
||||
static Result<Xapian::Query>
|
||||
parse_basic(const Field &field, Sexp &&vals, Mu::ParserFlags flags)
|
||||
{
|
||||
auto ngrams = any_of(flags & ParserFlags::SupportNgrams);
|
||||
auto ngrams = any_of(flags & ParserFlags::NgramsEnabled);
|
||||
if (!vals.stringp())
|
||||
return Err(Error::Code::InvalidArgument, "expected string");
|
||||
|
||||
@ -360,7 +360,7 @@ xapian_query_classic(const std::string& expr, Mu::ParserFlags flags)
|
||||
Xapian::QueryParser::FLAG_BOOLEAN |
|
||||
Xapian::QueryParser::FLAG_WILDCARD;
|
||||
|
||||
if (any_of(flags & ParserFlags::SupportNgrams))
|
||||
if (any_of(flags & ParserFlags::NgramsEnabled))
|
||||
xflags |= Xapian::QueryParser::FLAG_NGRAMS;
|
||||
|
||||
xqp.set_default_op(Xapian::Query::OP_AND);
|
||||
|
||||
@ -28,8 +28,8 @@ using namespace Mu;
|
||||
struct Query::Private {
|
||||
explicit Private(const Store& store) :
|
||||
store_{store},
|
||||
parser_flags_{any_of(store_.message_options() & Message::Options::SupportNgrams) ?
|
||||
ParserFlags::SupportNgrams : ParserFlags::None} {}
|
||||
parser_flags_{any_of(store_.message_options() & Message::Options::NgramsEnabled) ?
|
||||
ParserFlags::NgramsEnabled : ParserFlags::None} {}
|
||||
|
||||
Xapian::Enquire make_enquire(const std::string& expr, Field::Id sortfield_id,
|
||||
QueryFlags qflags) const;
|
||||
@ -253,7 +253,7 @@ Query::run(const std::string& expr, Field::Id sortfield_id,
|
||||
expr,
|
||||
any_of(qflags & QueryFlags::IncludeRelated) ? "yes" : "no",
|
||||
any_of(qflags & QueryFlags::Threading) ? "yes" : "no",
|
||||
any_of(priv_->parser_flags_ & ParserFlags::SupportNgrams) ? "yes" : "no",
|
||||
any_of(priv_->parser_flags_ & ParserFlags::NgramsEnabled) ? "yes" : "no",
|
||||
maxnum == 0 ? std::string{"∞"} : std::to_string(maxnum))};
|
||||
|
||||
return xapian_try_result([&]{
|
||||
|
||||
Reference in New Issue
Block a user