diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java index 847014ff646..d1a74a991da 100644 --- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java +++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java @@ -51,7 +51,7 @@ public abstract class TermProduction extends Production { /** Sets the term type to produce */ public void setTermType(TermType termType) { - Validator.ensureNotNull("Type of produced Term",termType); + Validator.ensureNotNull("Type of produced Term", termType); this.termType = termType; } @@ -60,19 +60,21 @@ public abstract class TermProduction extends Production { * TODO: Move to ruleevaluation */ protected void insertMatch(RuleEvaluation e, Match matched, Item newItem, int offset) { - newItem.setWeight(getWeight()); - int insertPosition=matched.getPosition()+offset; + if (getWeight() != 100) + newItem.setWeight(getWeight()); + int insertPosition = matched.getPosition()+offset; // This check is necessary (?) because earlier items may have been removed // after we recorded the match position. It is sort of hackish. A cleaner // solution would be to update the match position on changes - if (insertPosition>matched.getParent().getItemCount()) { - insertPosition=matched.getParent().getItemCount(); + if (insertPosition > matched.getParent().getItemCount()) { + insertPosition = matched.getParent().getItemCount(); } - e.insertItem(newItem,matched.getParent(),insertPosition,getTermType()); - if (e.getTraceLevel()>=6) - e.trace(6,"Inserted item '" + newItem + "' at position " + insertPosition + " producing " + e.getEvaluation().getQuery().getModel().getQueryTree()); + e.insertItem(newItem, matched.getParent(), insertPosition,getTermType()); + if (e.getTraceLevel() >= 6) + e.trace(6, "Inserted item '" + newItem + "' at position " + insertPosition + " producing " + + e.getEvaluation().getQuery().getModel().getQueryTree()); } protected String getLabelString() { |