From 0f954997037d6aa8b9e99b473de0eaf3a038fe0f Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 5 Mar 2013 12:31:32 +0100 Subject: [PATCH] if word scorer is on unigram make sure we score the current position not position 0 --- .../org/elasticsearch/search/suggest/phrase/WordScorer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/search/suggest/phrase/WordScorer.java b/src/main/java/org/elasticsearch/search/suggest/phrase/WordScorer.java index b0f9e128ac3..ad4924439bd 100644 --- a/src/main/java/org/elasticsearch/search/suggest/phrase/WordScorer.java +++ b/src/main/java/org/elasticsearch/search/suggest/phrase/WordScorer.java @@ -74,7 +74,7 @@ public abstract class WordScorer { public double score(Candidate[] path, CandidateSet[] candidateSet, int at, int gramSize) throws IOException { if (at == 0 || gramSize == 1) { - return Math.log10(channelScore(path[0], candidateSet[0].originalTerm) * scoreUnigram(path[0])); + return Math.log10(channelScore(path[at], candidateSet[at].originalTerm) * scoreUnigram(path[at])); } else if (at == 1 || gramSize == 2) { return Math.log10(channelScore(path[at], candidateSet[at].originalTerm) * scoreBigram(path[at], path[at - 1])); } else {