Skip to content

Binary search all terms.#13192

Open
vsop-479 wants to merge 9 commits into
apache:mainfrom
vsop-479:binary_search_all_term
Open

Binary search all terms.#13192
vsop-479 wants to merge 9 commits into
apache:mainfrom
vsop-479:binary_search_all_term

Conversation

@vsop-479

@vsop-479 vsop-479 commented Mar 20, 2024

Copy link
Copy Markdown
Contributor

Base on #11888 (binary search allEqual term leaf), this change implemented binary search for all term leaf (allEqual and unEqual).
I am still trying to do the same thing to NonLeaf term.

@vsop-479

Copy link
Copy Markdown
Contributor Author

Implemented binary search term non leaf (allEqual and unEqual).

@vsop-479

Copy link
Copy Markdown
Contributor Author

@jpountz @mikemccand
Please take a look when you get a chance.

@mikemccand mikemccand left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @vsop-479 -- it seems to get quite a bit more complex to add binary search to non-leaf blocks, and to non-allEqual blocks!

suffix = suffixLengthsReader.readVInt();
} else {
// Handle subCode for non leaf block.
postions = new int[entCount];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This many new allocations, at such a low level / hot spot (on each block load) seems risky / performance hurting?

I wonder how often we see allEqual for non-leaf blocks when the field is indeed fixed-length terms? It might happen often, depending on how evenly distributed the tokens are across term space? A random UUID should be quite even, at least on initial indexing, but a predictable ID (just 0-padded incrementing int, like luceneutil) might be less so?

@vsop-479 vsop-479 Mar 28, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, maybe it is less worth to implement this binary search to non-leaf blocks (both allEqual and non-allEqual ?).

Can we just take this change to non-allEqual leaf blocks? But it still need to allocate suffixes and offsets ( assume We don't need positions to set suffixLengthsReader's position after searching a block).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

assume We don't need positions to set suffixLengthsReader's position after searching a block.

Setting suffixLengthsReader's position is necessary, so we need positions.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Apr 12, 2024
@github-actions github-actions Bot removed the Stale label Apr 27, 2024
@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label May 11, 2024
@vsop-479

vsop-479 commented Jul 8, 2024

Copy link
Copy Markdown
Contributor Author

This many new allocations

Maybe we can share these allocations(suffixes, positions, positions) from searchers, since they are just immutable and non-stateful data.

@github-actions github-actions Bot removed the Stale label Jul 9, 2024
@vsop-479

vsop-479 commented Jul 9, 2024

Copy link
Copy Markdown
Contributor Author

Or, we just supply this (maybe only for non-allEqual leaf blocks) as an option, So, users can use it when their applications are not busy.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Jul 24, 2024
@github-actions github-actions Bot removed the Stale label Oct 1, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants