From d2f922b97f9236e87183568480ff4372e4c68c95 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 8 Aug 2022 19:58:57 +0200 Subject: [PATCH] Use AND conjunction by default in the QueryParser --- src/bin/patched_porobot_telegram.rs | 2 ++ src/search/cardsearch.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bin/patched_porobot_telegram.rs b/src/bin/patched_porobot_telegram.rs index 77ca0f9..84259c3 100644 --- a/src/bin/patched_porobot_telegram.rs +++ b/src/bin/patched_porobot_telegram.rs @@ -18,6 +18,8 @@ //! ``` //! //! +//! +//! //! [@patchedporobot]: https://t.me/patchedporobot use std::path::PathBuf; diff --git a/src/search/cardsearch.rs b/src/search/cardsearch.rs index 66c1c43..0198863 100644 --- a/src/search/cardsearch.rs +++ b/src/search/cardsearch.rs @@ -256,17 +256,23 @@ impl CardSearchEngine { /// Build the [QueryParser] of the search engine. fn parser(index: &Index, fields: CardSchemaFields) -> QueryParser { - QueryParser::for_index( + let mut parser = QueryParser::for_index( &index, vec![ fields.code, fields.name, fields.description, + fields.set, + fields.regions, fields.flavor, + fields.artist, fields.subtypes, fields.supertype, ] - ) + ); + parser.set_conjunction_by_default(); + // parser.set_field_boost(); + parser } /// Create a new [CardSearchEngine].