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

Tie-break suggestions by term #5978

Closed

Conversation

mikemccand
Copy link
Contributor

OK, DirectCandidateGenerator.CandidateSet.candidates also required
tie-breaking because CandidateScorer.findBestCandidates would change
its results depending on the sort order of the candidates in each
CandidateSet. And it was tricky because the tests would
intermittently fail since BytesRef.hashCode is different for
every JVM instance...

So I added an Arrays.sort in addCandidates, and fixed Correction and
Candidate to implement Comparable, and fixed CandidateScorer.updateTop
to use .compareTo when checking if the new correction competes with
the top of the PQ.

I folded in Simon's comment as-is into SuggestSearchTests, but I still
don't fully understand the test, e.g. why after
"phraseSuggestion.analyzer(null);" would this get bigram to
participate in scoring again? (The previous test did
.forceUnigrams(true) which I think is why xorn/xorr were tied for score).

@mikemccand mikemccand added bug and removed v1.3.0 labels May 18, 2014
@mikemccand
Copy link
Contributor Author

Talked to Simon ... he feels we should fix this for 1.2.

…default analyzer that favors xorr because xorr-the bigram was seen
@s1monw
Copy link
Contributor

s1monw commented May 18, 2014

LGTM - can you squash and push?

@mikemccand
Copy link
Contributor Author

OK will do ...

mikemccand added a commit that referenced this pull request May 18, 2014
If the score for two suggestions is the same, we now tie break by term; earlier terms (aaa) sort before later terms (zzz).

Closes #5978
@mikemccand mikemccand deleted the fix-suggester-test-fail-again branch May 18, 2014 20:54
@clintongormley clintongormley added the :Search/Suggesters "Did you mean" and suggestions as you type label Jun 7, 2015
@clintongormley clintongormley changed the title tie-break suggestions by term Tie-break suggestions by term Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Suggesters "Did you mean" and suggestions as you type v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants