Skip to content

Conversation

@fulmicoton-dd
Copy link
Collaborator

No description provided.

@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch from 3bc26fa to 4800401 Compare December 30, 2025 17:45
@fulmicoton fulmicoton requested a review from PSeitz December 30, 2025 17:46
@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch 5 times, most recently from eac4c95 to 1898828 Compare December 30, 2025 22:30
@fulmicoton fulmicoton marked this pull request as ready for review December 30, 2025 22:41
@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch 7 times, most recently from 20ef4f2 to f98ba14 Compare December 31, 2025 17:15
tantivy requires Scorer to be positioned on a DocId at all time.
This decision is not performance neutral.

When we have an intersection of a heavy DocSet with a lighter one
forcing the positioning of the first doc is needlessly expensive.

This PR fixes this by introducing a seek_doc parameter in the weight function.
Weights may skip over documents when they create the Scorer.
@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch from f98ba14 to 98be1a5 Compare December 31, 2025 17:20
@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch from d954b74 to 601541e Compare January 2, 2026 12:07
}

/// Returns a priority number used to sort weights when running an
/// intersection.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a comment here what higher or lower numbers mean

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. Added a comment.

@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch from b3db43b to d210a30 Compare January 6, 2026 13:33
@fulmicoton-dd fulmicoton-dd force-pushed the paul.masurel/skip-first-doc-on-intersection branch from d210a30 to a5dc888 Compare January 6, 2026 13:37
/// Creates a Segment Postings from a
/// - `BlockSegmentPostings`,
/// - a position reader
/// - a target document to seek to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// - a target document to seek to
/// - a target document to seek to within the passed block

not sure if that's correct (the comment and variable name don't match)

let Some(term_info) = self.get_term_info(term)? else {
return Ok(None);
};
let block_postings_not_loaded =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let block_postings_not_loaded =
let block_postings =

Copy link
Collaborator

@PSeitz PSeitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants