Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed May 31, 2024
1 parent 1b426d6 commit 363e1c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion quickwit/quickwit-search/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ pub(crate) struct QuickwitCollector {

impl QuickwitCollector {
pub fn is_count_only(&self) -> bool {
self.max_hits == 0 && self.aggregation.is_none() && self.search_after.is_none()
self.max_hits == 0 && self.aggregation.is_none()
}
/// Updates search parameters affecting the returned documents.
/// Does not update aggregations.
Expand Down
4 changes: 2 additions & 2 deletions quickwit/quickwit-search/src/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use tantivy::{DateTime, Index, ReloadPolicy, Searcher, Term};
use tracing::*;

use crate::collector::{make_collector_for_split, make_merge_collector, IncrementalCollector};
use crate::root::is_metadata_count_request_with_ast;
use crate::root::{is_metadata_count_request, is_metadata_count_request_with_ast};
use crate::service::{deserialize_doc_mapper, SearcherContext};
use crate::{QuickwitAggregations, SearchError};

Expand Down Expand Up @@ -1038,7 +1038,7 @@ async fn resolve_storage_and_leaf_search(
}

/// Optimizes the search_request based on CanSplitDoBetter
/// Returns a tuple of (the search_request was optimized, split can return better results)
/// Returns true if the split can return better results
fn check_optimize_search_request(
search_request: &mut SearchRequest,
split: &SplitIdAndFooterOffsets,
Expand Down
7 changes: 5 additions & 2 deletions quickwit/quickwit-search/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,11 @@ pub fn is_metadata_count_request_with_ast(query_ast: &QueryAst, request: &Search
return false;
}

// TODO: if the start and end timestamp encompass the whole split, it is still a count query
// So some could be checked on metadata
// If the start and end timestamp encompass the whole split, it is still a count query.
// We remove this currently on the leaf level, but not yet on the root level.
// There's a small advantage when we would do this on the root level, since we have the
// counts available on the split. On the leaf it is currently required to open the split
// to get the count.
if request.start_timestamp.is_some() || request.end_timestamp.is_some() {
return false;
}
Expand Down

0 comments on commit 363e1c2

Please sign in to comment.