1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-23 01:54:22 +00:00

Use AND conjunction by default in the QueryParser

This commit is contained in:
Steffo 2022-08-08 19:58:57 +02:00
parent bd335b4712
commit d2f922b97f
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 10 additions and 2 deletions

View file

@ -18,6 +18,8 @@
//! ``` //! ```
//! //!
//! //!
//!
//!
//! [@patchedporobot]: https://t.me/patchedporobot //! [@patchedporobot]: https://t.me/patchedporobot
use std::path::PathBuf; use std::path::PathBuf;

View file

@ -256,17 +256,23 @@ impl CardSearchEngine {
/// Build the [QueryParser] of the search engine. /// Build the [QueryParser] of the search engine.
fn parser(index: &Index, fields: CardSchemaFields) -> QueryParser { fn parser(index: &Index, fields: CardSchemaFields) -> QueryParser {
QueryParser::for_index( let mut parser = QueryParser::for_index(
&index, &index,
vec![ vec![
fields.code, fields.code,
fields.name, fields.name,
fields.description, fields.description,
fields.set,
fields.regions,
fields.flavor, fields.flavor,
fields.artist,
fields.subtypes, fields.subtypes,
fields.supertype, fields.supertype,
] ]
) );
parser.set_conjunction_by_default();
// parser.set_field_boost();
parser
} }
/// Create a new [CardSearchEngine]. /// Create a new [CardSearchEngine].