Skip to content
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-10319: make ForUtil#BLOCK_SIZE changeable #545

Closed
wants to merge 9 commits into from

Conversation

gf2121
Copy link
Contributor

@gf2121 gf2121 commented Dec 16, 2021

In LUCENE-10315, I tried to generate a ForUtil whose BLOCK_SIZE=512, I thought it could be simple since it looks like i only need to change the BLOCK_SIZE, but it turns out that there are a lot of hard code values...

So this is trying to make all hard code value generated from the BLOCK_SIZE in case we need a ForUtil somewhere else or want to change BLOCK_SIZE in postings in feature.

I tried to make the BLOCK_SIZE = 64 / 256 and all tests passed.

@jpountz
Copy link
Contributor

jpountz commented Jan 5, 2022

I'm a bit torn as this also makes the code harder to read with all these constants with complex names.

@gf2121
Copy link
Contributor Author

gf2121 commented Jan 5, 2022

Thanks @jpountz ! This is indeed making codes harder to read. I tried to make all these complex constants generated from script, keeping ForUtil.java clean. How does it look now?

@@ -1051,4 +1052,76 @@ private static void decode24(DataInput in, long[] tmp, long[] longs) throws IOEx
longs[longsIdx + 0] = l0;
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let these codes be generated from the script, so that it can change with the change of BLOCK_SIZE.

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.

None yet

2 participants