Skip to content

Commit 91d0298

Browse files
authored
Merge pull request #305 from korpling/feature/file-too-large-error
Fix "file too large" error
2 parents 4bed506 + 11ffc56 commit 91d0298

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
if a backup folder exists.
1212
- Add bug fixes for relANNIS import discovered testing the Annatto relANNIS
1313
importer.
14-
14+
- Fix `FileTooLarge` error when searching for token precedence where the
15+
statistics indicate that this search is impossible.
1516

1617
## [3.3.1] - 2024-06-04
1718

graphannis/src/annis/db/aql/operators/precedence.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ impl<'a> BinaryOperatorBase for Precedence<'a> {
178178
std::ops::Bound::Excluded(max_dist) => max_dist - 1,
179179
};
180180
let max_possible_dist = std::cmp::min(max_dist, stats_order.max_depth);
181-
let num_of_descendants = max_possible_dist - self.spec.dist.min_dist() + 1;
181+
let num_of_descendants =
182+
max_possible_dist.saturating_sub(self.spec.dist.min_dist()) + 1;
182183

183184
return Ok(EstimationType::Selectivity(
184185
(num_of_descendants as f64) / (stats_order.nodes as f64 / 2.0),

graphannis/tests/searchtest.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,27 @@ fn negative_token_search_applies_leaf_filter() {
364364
}
365365
}
366366
}
367+
368+
#[ignore]
369+
#[test]
370+
fn no_error_on_large_token_distance() {
371+
let cs = CORPUS_STORAGE.as_ref().unwrap();
372+
373+
let q = SearchQuery {
374+
corpus_names: &["subtok.demo"],
375+
query: r#"tok .100 tok"#,
376+
query_language: QueryLanguage::AQL,
377+
timeout: None,
378+
};
379+
// There should be an empty result, but no error
380+
let result = cs
381+
.find(
382+
q.clone(),
383+
0,
384+
Some(1),
385+
graphannis::corpusstorage::ResultOrder::Normal,
386+
)
387+
.unwrap();
388+
389+
assert_eq!(0, result.len());
390+
}

0 commit comments

Comments
 (0)