Skip to content

Commit

Permalink
Fix regression parsing legacy meta queries with multiple alternatives
Browse files Browse the repository at this point in the history
matthias-stemmler committed Sep 24, 2024
1 parent 91b8558 commit 492ee9d
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion graphannis/src/annis/db/aql/mod.rs
Original file line number Diff line number Diff line change
@@ -499,7 +499,7 @@ pub fn parse(query_as_aql: &str, quirks_mode: bool) -> Result<Disjunction> {

if quirks_mode {
// apply the meta constraints to first node of all conjunctions
let first_node_var = mapped.get_variable_by_node_nr(0);
let first_node_var = mapped.get_variable_by_node_nr(var_idx_offset);
add_legacy_metadata_constraints(
&mut mapped,
legacy_meta_search.clone(),
18 changes: 18 additions & 0 deletions graphannis/tests/searchtest.rs
Original file line number Diff line number Diff line change
@@ -388,3 +388,21 @@ fn no_error_on_large_token_distance() {

assert_eq!(0, result.len());
}

#[ignore]
#[test]
fn legacy_meta_query_with_multiple_alternatives() {
let cs = CORPUS_STORAGE.as_ref().unwrap();

// "buy" and "favorite" each appear exactly once in type="interview" and once in type="news"
let query = SearchQuery {
corpus_names: &["GUM"],
query: "\"buy\" | \"favorite\" & meta::type=\"interview\"",
query_language: QueryLanguage::AQLQuirksV3,
timeout: None,
};

let count = cs.count(query).unwrap();

assert_eq!(count, 2);
}

0 comments on commit 492ee9d

Please sign in to comment.