diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-24 11:55:43 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-24 11:55:43 +0200 |
commit | e74a9e9f892be61c2a67bb0fbd4d888840d98709 (patch) | |
tree | 55d9faa626ad135aadbb233e468bd05c95e88556 /container-search | |
parent | d6ad11cb3ca05d905424fdb4213955a92e6ffe99 (diff) |
Set the right index in case the ngram item is indexable
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java index c487182c65d..2775ba33146 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/NGramSearcher.java @@ -109,17 +109,18 @@ public class NGramSearcher extends Searcher { * @return the root of the query subtree produced by this, containing the split items */ protected Item splitToGrams(Item term, String text, int gramSize, Query query) { - CompositeItem and = createGramRoot(query); String index = ((HasIndexItem)term).getIndexName(); + CompositeItem gramsItem = createGramRoot(query); + gramsItem.setIndexName(index); Substring origin = ((BlockItem)term).getOrigin(); for (Iterator<GramSplitter.Gram> i = getGramSplitter().split(text,gramSize); i.hasNext(); ) { GramSplitter.Gram gram = i.next(); WordItem gramWord = new WordItem(gram.extractFrom(text), index, false, origin); gramWord.setWeight(term.getWeight()); gramWord.setProtected(true); - and.addItem(gramWord); + gramsItem.addItem(gramWord); } - return and.getItemCount()==1 ? and.getItem(0) : and; // return the AndItem, or just the single gram if not multiple + return gramsItem.getItemCount()==1 ? gramsItem.getItem(0) : gramsItem; // return the AndItem, or just the single gram if not multiple } /** |