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
Ensure selection of best terms is indeed O(n) #6657
Conversation
I left a comment on the lucene issue. |
int x; | ||
|
||
Int() { | ||
x = 1; |
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.
Minor, but both places that use this could avoid assigning a value by always using the contents of else
block if this were initialized to 0
.
Int cnt = termFreqMap.get(term);
if (cnt == null) {
cnt = new Int();
termFreqMap.put(term, cnt);
}
cnt.x += freq;
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.
Thanks for the comment, I'm thinking that out of clarity we can keep the else
block.
I committed this to lucene will be in 4.10 |
Previously the size of the priority queue was wrongly set to the total number of terms. Instead, it should be set to 'maxQueryTerms'. This makes the selection of best terms O(n), instead of O(n*log(n)). Jira patch: https://issues.apache.org/jira/browse/LUCENE-5795 Closes elastic#6657
Previously the size of the priority queue was wrongly set to the total number of terms. Instead, it should be set to 'maxQueryTerms'. This makes the selection of best terms O(n), instead of O(n*log(n)). Jira patch: https://issues.apache.org/jira/browse/LUCENE-5795 Closes #6657
Previously the size of the priority queue was wrongly set to the total number
of terms. Instead, it should be set to 'maxQueryTerms'. This makes the
selection of best terms O(n), instead of O(n*log(n)).
Jira patch: https://issues.apache.org/jira/browse/LUCENE-5795