New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LUCENE-10585: Scrub copy/paste code in the facets module and attempt to simplify a bit #915
Conversation
…to simplify a bit
Ran benchmarks to make sure this didn't regress performance in any meaningful way. I'm not seeing any regressions:
|
return Arrays.asList(results); | ||
} | ||
|
||
abstract int getCount(int ord); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe add a javadoc here explaining if counts are aggregated at indexing time, we can just retrieve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Thanks!
Hi @gsmiller, thanks for making a lot of improvements to the code, and it looks great to me! I also ran the benchmarks for facet and do not observe much difference from the main branch. I added getTopDims to benchmarks but the PR hasn't merged yet, so the attached results are from my local. Thanks! |
Thanks @Yuti-G for the feedback and benchmark results! I appreciate you taking a look since I know you're quite familiar with this code. I saw a couple opportunities to de-dupe some code, but you did all the hard work introducing the feature. Thanks again! |
Thank you @Yuti-G for running the dedicated But: the |
I think it's just noise. I just re-run the dedicated luceneutil faceting benchmark against the main branch: |
…en in getTopDims if we know dim counts will be inaccurate ahead of time
@Yuti-G I just updated the PR with some additional comments/javadoc and a very minor optimization in the SSDV#getTopDims case. Could you have a look at the latest changes when you get a chance? |
Since this change is purely meant to remove some code duplication and make some very minor optimizations, and doesn't modify the API or expose any additional API surface area, I plan to merge in the next couple of days unless anyone objects. If anyone wants more time to review or has feedback, I'm more than happy to wait. Thanks! |
Looks good to me! I will rebase my current work at #914 - |
@Yuti-G this is merged onto |
…to simplify a bit (apache#915)
Description
The facets module has had a fair amount of recent development, some resulting in a fair amount of copy/paste duplication. This attempts to clean it up a bit and simplify/refactor some of the internal functionality.
Solution
Minor internal refactoring of some facet implementations and extraction of a common parent class to contain some duplicated logic in the SSDV faceting implementations.
Tests
No new tests were written. All existing testing is still passing.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.