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

FunctionScoreQuery should implement two-phase iteration. #15602

Merged

Conversation

Projects
None yet
3 participants
@jpountz
Copy link
Contributor

jpountz commented Dec 22, 2015

FunctionScoreQuery should do two things that it doesn't do today:

  • propagate the two-phase iterator from the wrapped scorer so that things are
    still executed efficiently eg. if a phrase or geo-distance query is wrapped
  • filter out docs that don't have a high enough score using two-phase
    iteration: this way the score is only checked when everything else matches

While doing these changes, I noticed that minScore was ignored when scores were
not needed and that explain did not take it into account, so I fixed these
issues as well.

}

@Override
public TwoPhaseIterator twoPhaseIterator() {

This comment has been minimized.

Copy link
@rjernst

rjernst Dec 22, 2015

Member

Can we have a unit test for this scorer? I know it is tested indirectly through FunctionScoreTests, but a unit test here seems like it would be simple?

@rjernst

This comment has been minimized.

Copy link
Member

rjernst commented Dec 22, 2015

LGTM

@spinscale spinscale added v2.3.0 and removed v2.2.0 labels Dec 23, 2015

FunctionScoreQuery should implement two-phase iteration.
FunctionScoreQuery should do two things that it doesn't do today:
 - propagate the two-phase iterator from the wrapped scorer so that things are
   still executed efficiently eg. if a phrase or geo-distance query is wrapped
 - filter out docs that don't have a high enough score using two-phase
   iteration: this way the score is only checked when everything else matches

While doing these changes, I noticed that minScore was ignored when scores were
not needed and that explain did not take it into account, so I fixed these
issues as well.

@jpountz jpountz force-pushed the jpountz:enhancement/function_score_two_phase branch to 07658f5 Dec 23, 2015

jpountz added a commit that referenced this pull request Dec 23, 2015

Merge pull request #15602 from jpountz/enhancement/function_score_two…
…_phase

FunctionScoreQuery should implement two-phase iteration.

@jpountz jpountz merged commit b771daa into elastic:master Dec 23, 2015

1 check passed

CLA Commit author is a member of Elasticsearch
Details

@jpountz jpountz deleted the jpountz:enhancement/function_score_two_phase branch Dec 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.