aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-12-10 11:37:20 -0800
committerJon Bratseth <bratseth@verizonmedia.com>2019-12-10 11:37:20 -0800
commit707df3c8f1aa7db5e1f23c7458ba1a5ae0fb1ec6 (patch)
tree296d9c1a5e5f33d2254770d235b61df0733d690c /container-search/src/main/java
parentb8d2859a9fece15dac2b9260d71dea39f8ce19b3 (diff)
Non-functional changes only
Diffstat (limited to 'container-search/src/main/java')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java16
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/engine/Evaluation.java102
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/engine/FlattenedItem.java4
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/engine/Match.java14
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java48
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/rule/CompositeCondition.java6
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/rule/Condition.java14
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/rule/SequenceCondition.java6
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermCondition.java42
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java18
10 files changed, 134 insertions, 136 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java
index e8e4dc39fd5..f49e49c1771 100644
--- a/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/querytransform/PhraseMatcher.java
@@ -117,23 +117,23 @@ public class PhraseMatcher {
/** Returns null if this word does not match the automaton, a single-item list if it does */
private List<Phrase> matchSingleItem(TermItem termItem) {
- String matchWord=toLowerCase(termItem.stringValue());
- String replaceWord=null;
+ String matchWord = toLowerCase(termItem.stringValue());
+ String replaceWord = null;
FSA.State state = phraseFSA.getState();
if (!matches(state,matchWord)) {
if (!ignorePluralForm) return null;
- matchWord=switchForm(matchWord);
- if (!matches(state,matchWord)) return null;
- replaceWord=matchWord;
+ matchWord = switchForm(matchWord);
+ if (!matches(state, matchWord)) return null;
+ replaceWord = matchWord;
}
- List<Phrase> itemList=new java.util.ArrayList<>(1);
- itemList.add(new Phrase(termItem,replaceWord,state.dataString()));
+ List<Phrase> itemList = new java.util.ArrayList<>(1);
+ itemList.add(new Phrase(termItem, replaceWord, state.dataString()));
return itemList;
}
- private boolean matches(FSA.State state,String word) {
+ private boolean matches(FSA.State state, String word) {
state.start();
state.delta(word);
return state.isFinal();
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Evaluation.java b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Evaluation.java
index 4e8bbc2ae11..dafc31c66fa 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Evaluation.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Evaluation.java
@@ -19,7 +19,7 @@ import java.util.Set;
public class Evaluation {
// TODO: Retrofit query into the namespace construct
- private ParameterNameSpace parameterNameSpace=null;
+ private ParameterNameSpace parameterNameSpace = null;
private Query query;
@@ -36,18 +36,18 @@ public class Evaluation {
* The amount of context information to collect about this evaluation.
* 0 means no context information, higher numbers means more context information.
*/
- private int traceLevel=0;
+ private int traceLevel = 0;
- private String traceIndentation="";
+ private String traceIndentation = "";
/** See RuleEngine */
- private Set<Integer> matchDigests=new HashSet<>();
+ private Set<Integer> matchDigests = new HashSet<>();
/** The previous size of this query (see RuleEngine), set on matches only */
- private int previousQuerySize=0;
+ private int previousQuerySize = 0;
/** Should we allow stemmed matches? */
- private boolean stemming=true;
+ private boolean stemming = true;
public Evaluation(Query query) {
this(query,0);
@@ -60,44 +60,44 @@ public class Evaluation {
* @param traceLevel the amount of tracing to do
*/
public Evaluation(Query query, int traceLevel) {
- this.query=query;
- this.traceLevel=traceLevel;
+ this.query = query;
+ this.traceLevel = traceLevel;
reset();
- ruleEvaluation=new RuleEvaluation(this);
+ ruleEvaluation = new RuleEvaluation(this);
}
/** Resets the item iterator to point to the first item */
public void reset() {
- if (flattenedItems!=null)
- previousQuerySize=flattenedItems.size();
- currentIndex=0;
- traceIndentation="";
- flattenedItems=new java.util.ArrayList<>();
- flatten(query.getModel().getQueryTree().getRoot(),0,flattenedItems);
+ if (flattenedItems != null)
+ previousQuerySize = flattenedItems.size();
+ currentIndex = 0;
+ traceIndentation = "";
+ flattenedItems = new java.util.ArrayList<>();
+ flatten(query.getModel().getQueryTree().getRoot(), 0, flattenedItems);
}
/** Sets the item iterator to point to the last item: */
- public void setToLast() { // PGA
- if (flattenedItems!=null)
- currentIndex = flattenedItems.size()-1;
+ public void setToLast() {
+ if (flattenedItems != null)
+ currentIndex = flattenedItems.size() - 1;
else
currentIndex = -1;
}
/** Resets the item iterator to point to the last item: */
- public void resetToLast() { // PGA
- if (flattenedItems!=null)
- previousQuerySize=flattenedItems.size();
- traceIndentation="";
- flattenedItems=new java.util.ArrayList<>();
- flatten(query.getModel().getQueryTree().getRoot(),0,flattenedItems);
- currentIndex = flattenedItems.size()-1;
+ public void resetToLast() {
+ if (flattenedItems != null)
+ previousQuerySize = flattenedItems.size();
+ traceIndentation = "";
+ flattenedItems = new java.util.ArrayList<>();
+ flatten(query.getModel().getQueryTree().getRoot(), 0, flattenedItems);
+ currentIndex = flattenedItems.size() - 1;
}
public Query getQuery() { return query; }
/** Set to true to enable stemmed matches. True by default */
- public void setStemming(boolean stemming) { this.stemming=stemming; }
+ public void setStemming(boolean stemming) { this.stemming = stemming; }
/** Returns whether stemmed matches are allowed. True by default */
public boolean getStemming() { return stemming; }
@@ -121,13 +121,13 @@ public class Evaluation {
/** Returns the current item, or null if there is no more elements */
public FlattenedItem currentItem() {
- if ( (currentIndex>=flattenedItems.size()) || (currentIndex<0)) return null; //PGA
+ if ( (currentIndex >= flattenedItems.size()) || (currentIndex < 0)) return null;
return flattenedItems.get(currentIndex);
}
/** Returns a fresh rule evaluation starting at the current position of this */
public RuleEvaluation freshRuleEvaluation() {
- ruleEvaluation.initialize(flattenedItems,currentIndex);
+ ruleEvaluation.initialize(flattenedItems, currentIndex);
return ruleEvaluation;
}
@@ -224,7 +224,7 @@ public class Evaluation {
* segment phrase, and the original parent's parent is a phrase, the terms
* from the parent will be moved to the parent's parent.)
*
- * @param item The item for which the parent shall be made mutable
+ * @param item the item for which the parent shall be made mutable
*/
public void makeParentMutable(TermItem item) {
CompositeItem parent = item.getParent();
@@ -244,7 +244,7 @@ public class Evaluation {
* @param desiredParentType the desired type of the composite which contains item when this returns
*/
public void insertItem(Item item, CompositeItem parent, int index, TermType desiredParentType) {
- if (parent==null) { // TODO: Accommodate for termtype in this case too
+ if (parent == null) { // TODO: Accommodate for termtype in this case too
query.getModel().getQueryTree().setRoot(item);
return;
@@ -253,24 +253,24 @@ public class Evaluation {
if (parent.getItemCount()>0 && parent instanceof QueryTree && parent.getItem(0) instanceof CompositeItem) {
// combine with the existing root instead
parent=(CompositeItem)parent.getItem(0);
- if (index==1) { // that means adding it after the existing root
- index=parent.getItemCount();
+ if (index == 1) { // that means adding it after the existing root
+ index = parent.getItemCount();
}
}
- if (( desiredParentType==TermType.DEFAULT || desiredParentType.hasItemClass(parent.getClass()) )
- && equalIndexNameIfParentIsPhrase(item,parent)) {
+ if (( desiredParentType == TermType.DEFAULT || desiredParentType.hasItemClass(parent.getClass()) )
+ && equalIndexNameIfParentIsPhrase(item, parent)) {
addItem(parent,index,item,desiredParentType);
}
else {
- insertIncompatibleItem(item,parent,query,desiredParentType);
+ insertIncompatibleItem(item, parent, query, desiredParentType);
}
}
- private void addItem(CompositeItem parent,int index,Item item,TermType desiredParentType) {
+ private void addItem(CompositeItem parent, int index, Item item, TermType desiredParentType) {
if (parent instanceof NotItem) {
- if (index==0 && parent.getItem(0)==null) { // Case 1: The current positive is null and we are adding a positive
- parent.setItem(0,item);
+ if (index == 0 && parent.getItem(0) == null) { // Case 1: The current positive is null and we are adding a positive
+ parent.setItem(0, item);
}
else if (index<=1 && !(parent.getItem(0) instanceof CompositeItem)) { // Case 2: The positive must become a composite
CompositeItem positiveComposite=(CompositeItem)desiredParentType.createItemClass();
@@ -395,27 +395,27 @@ public class Evaluation {
}
private void flatten(Item item,int position,List<FlattenedItem> toList) {
- if (item==null) return;
+ if (item == null) return;
if (item.isFilter()) return;
if (item instanceof TermItem) { // make eligible for matching
- toList.add(new FlattenedItem((TermItem)item,position));
+ toList.add(new FlattenedItem((TermItem)item, position));
return;
}
if (item instanceof CompositeItem) { // make children eligible for matching
- CompositeItem composite=(CompositeItem)item;
- int childPosition=0;
- for (Iterator<?> i=composite.getItemIterator(); i.hasNext(); ) {
- flatten((Item)i.next(),childPosition++,toList);
+ CompositeItem composite = (CompositeItem)item;
+ int childPosition = 0;
+ for (Iterator<?> i = composite.getItemIterator(); i.hasNext(); ) {
+ flatten((Item)i.next(), childPosition++, toList);
}
}
- // other terms are unmatchable
+ // other terms are inmatchable
}
public void trace(int level,String message) {
- if (level>getTraceLevel()) return;
+ if (level > getTraceLevel()) return;
query.trace(traceIndentation + message,false,1);
}
@@ -427,20 +427,20 @@ public class Evaluation {
public int getTraceLevel() { return traceLevel; }
public void indentTrace() {
- traceIndentation=traceIndentation + " ";
+ traceIndentation =traceIndentation + " ";
}
public void unindentTrace() {
if (traceIndentation.length()<3)
- traceIndentation="";
+ traceIndentation ="";
else
- traceIndentation=traceIndentation.substring(3);
+ traceIndentation =traceIndentation.substring(3);
}
public NameSpace getNameSpace(String nameSpaceName) {
if (nameSpaceName.equals("parameter")) {
- if (parameterNameSpace==null)
- parameterNameSpace=new ParameterNameSpace();
+ if (parameterNameSpace == null)
+ parameterNameSpace = new ParameterNameSpace();
return parameterNameSpace;
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/FlattenedItem.java b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/FlattenedItem.java
index 360fa3d980a..bf10f54928b 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/FlattenedItem.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/FlattenedItem.java
@@ -16,8 +16,8 @@ public class FlattenedItem {
private int position;
public FlattenedItem(TermItem item,int position) {
- this.item=item;
- this.position=position;
+ this.item = item;
+ this.position = position;
}
public TermItem getItem() { return item; }
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Match.java b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Match.java
index 691aeb33d26..9e7c761deba 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Match.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/Match.java
@@ -31,14 +31,14 @@ public class Match {
* @param replaceValue the string to replace this match by, usually the item.getIndexedString()
* which is what the replace value will be if it is passed as null here
*/
- public Match(FlattenedItem item,String replaceValue) {
- this.item=item.getItem();
- if (replaceValue==null)
- this.replaceValue=item.getItem().getIndexedString();
+ public Match(FlattenedItem item, String replaceValue) {
+ this.item = item.getItem();
+ if (replaceValue == null)
+ this.replaceValue = item.getItem().getIndexedString();
else
- this.replaceValue=replaceValue;
- this.parent=this.item.getParent();
- this.position=item.getPosition();
+ this.replaceValue = replaceValue;
+ this.parent = this.item.getParent();
+ this.position = item.getPosition();
}
public int getPosition() { return position; }
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java
index bd160f68d31..29a781b1e68 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java
@@ -41,44 +41,44 @@ public class RuleEvaluation {
private String currentContext;
/** A list of referencedMatches */
- private List<ReferencedMatches> referencedMatchesList =new java.util.ArrayList<>();
+ private List<ReferencedMatches> referencedMatchesList = new java.util.ArrayList<>();
- private List<Match> nonreferencedMatches=new java.util.ArrayList<>();
+ private List<Match> nonreferencedMatches = new java.util.ArrayList<>();
/** The evaluation owning this */
private Evaluation evaluation;
/** The choice points saved in this evaluation */
- private Stack<Choicepoint> choicepoints=null;
+ private Stack<Choicepoint> choicepoints = null;
/* The last value returned by a condition evaluated in this, may be null */
- private Object value=null;
+ private Object value = null;
/** True when we are evaluating inside a condition which inverts the truth value */
- private boolean inNegation=false;
+ private boolean inNegation = false;
/**
* A label we should use to match candidate terms for.
* Used to propagate a label from e.g. reference conditions to named conditions
*/
- private String currentLabel=null;
+ private String currentLabel = null;
public RuleEvaluation(Evaluation owner) {
- this.evaluation=owner;
+ this.evaluation = owner;
}
- public void initialize(List<FlattenedItem> list,int startPosition) {
- this.startPosition=startPosition;
- items=list;
+ public void initialize(List<FlattenedItem> list, int startPosition) {
+ this.startPosition = startPosition;
+ items = list;
reinitialize();
}
void reinitialize() {
- position=startPosition;
- currentContext=null;
+ position = startPosition;
+ currentContext = null;
referencedMatchesList.clear();
nonreferencedMatches.clear();
- if (choicepoints!=null)
+ if (choicepoints != null)
choicepoints.clear();
}
@@ -123,13 +123,13 @@ public class RuleEvaluation {
* or null if there are no more elements
*/
public FlattenedItem currentItem() {
- if (position>=items.size()) return null;
+ if (position >= items.size()) return null;
return items.get(position);
}
public FlattenedItem previousItem() {
- if (position-1<0) return null;
- return items.get(position-1);
+ if (position-1 < 0) return null;
+ return items.get(position - 1);
}
/** Returns the position of the current item */
@@ -208,13 +208,13 @@ public class RuleEvaluation {
* @param item the match to add
* @param replaceString the string to replace this match by, usually the item.getIndexedValue()
*/
- public void addMatch(FlattenedItem item,String replaceString) {
+ public void addMatch(FlattenedItem item, String replaceString) {
evaluation.makeParentMutable(item.getItem());
- Match match=new Match(item,replaceString);
- if (currentContext!=null) {
- ReferencedMatches matches=getReferencedMatches(currentContext);
- if (matches==null) {
- matches=new ReferencedMatches(currentContext);
+ Match match = new Match(item,replaceString);
+ if (currentContext != null) {
+ ReferencedMatches matches = getReferencedMatches(currentContext);
+ if (matches == null) {
+ matches = new ReferencedMatches(currentContext);
referencedMatchesList.add(matches);
}
matches.addMatch(match);
@@ -226,8 +226,8 @@ public class RuleEvaluation {
/** Returns the referenced matches for a context name, or null if none */
public ReferencedMatches getReferencedMatches(String name) {
- for (Iterator<ReferencedMatches> i=referencedMatchesList.iterator(); i.hasNext(); ) {
- ReferencedMatches matches=i.next();
+ for (Iterator<ReferencedMatches> i = referencedMatchesList.iterator(); i.hasNext(); ) {
+ ReferencedMatches matches = i.next();
if (name.equals(matches.getContextName()))
return matches;
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/CompositeCondition.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/CompositeCondition.java
index eea1fd1941f..4accef2abbb 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/CompositeCondition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/CompositeCondition.java
@@ -115,9 +115,9 @@ public abstract class CompositeCondition extends Condition {
/** Returns whether all the conditions of this matches the current evaluation state */
protected final boolean allSubConditionsMatches(RuleEvaluation e) {
- for (Iterator<Condition> i=conditionIterator(); i.hasNext(); ) {
- Condition subCondition=i.next();
- if (!subCondition.matches(e))
+ for (Iterator<Condition> i = conditionIterator(); i.hasNext(); ) {
+ Condition subCondition = i.next();
+ if ( ! subCondition.matches(e))
return false;
}
return true;
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/Condition.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/Condition.java
index 0a274bac905..141d16b14e2 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/Condition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/Condition.java
@@ -114,20 +114,20 @@ public abstract class Condition {
if (!matchesStartAnchor(e)) return false;
- String higherLabel=e.getCurrentLabel();
- if (getLabel()!=null)
+ String higherLabel = e.getCurrentLabel();
+ if (getLabel() != null)
e.setCurrentLabel(getLabel());
- boolean matches=doesMatch(e);
- while (!matches && hasOpenChoicepoint(e)) {
- matches=doesMatch(e);
+ boolean matches = doesMatch(e);
+ while ( ! matches && hasOpenChoicepoint(e)) {
+ matches = doesMatch(e);
}
e.setCurrentLabel(higherLabel);
- if (!matchesEndAnchor(e)) return false;
+ if ( ! matchesEndAnchor(e)) return false;
- traceResult(matches,e);
+ traceResult(matches, e);
return matches;
}
finally {
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/SequenceCondition.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/SequenceCondition.java
index a3c66cec01b..95e57974b2f 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/SequenceCondition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/SequenceCondition.java
@@ -17,16 +17,16 @@ public class SequenceCondition extends CompositeCondition {
}
public boolean doesMatch(RuleEvaluation e) {
- Choicepoint choicepoint=e.getChoicepoint(this,true);
+ Choicepoint choicepoint = e.getChoicepoint(this, true);
choicepoint.updateState();
- boolean matches=allSubConditionsMatches(e);
+ boolean matches = allSubConditionsMatches(e);
if (!matches)
choicepoint.backtrack();
return matches;
}
protected boolean useParentheses() {
- return (getParent()!=null
+ return (getParent() != null
&& ! (getParent() instanceof ChoiceCondition));
}
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermCondition.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermCondition.java
index 9baa240fb43..82e64e4229b 100644
--- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermCondition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermCondition.java
@@ -12,7 +12,7 @@ import com.yahoo.prelude.semantics.engine.RuleEvaluation;
*/
public class TermCondition extends Condition {
- private String term,termPlusS;
+ private String term, termPlusS;
/** Creates an invalid term */
public TermCondition() { }
@@ -21,35 +21,33 @@ public class TermCondition extends Condition {
this(null,term);
}
- public TermCondition(String label,String term) {
+ public TermCondition(String label, String term) {
super(label);
- this.term=term;
- termPlusS=term + "s";
+ this.term = term;
+ termPlusS = term + "s";
}
public String getTerm() { return term; }
public void setTerm(String term) {
- this.term=term;
- termPlusS=term + "s";
+ this.term = term;
+ termPlusS = term + "s";
}
protected boolean doesMatch(RuleEvaluation e) {
// TODO: Move this into the respective namespaces when query becomes one */
- if (getNameSpace()!=null) {
- NameSpace nameSpace=e.getEvaluation().getNameSpace(getNameSpace());
- return nameSpace.matches(term,e);
+ if (getNameSpace() != null) {
+ NameSpace nameSpace = e.getEvaluation().getNameSpace(getNameSpace());
+ return nameSpace.matches(term, e);
}
else {
- if (e.currentItem()==null)
- return false;
+ if (e.currentItem() == null) return false;
+ if ( ! labelMatches(e)) return false;
- if (!labelMatches(e)) return false;
-
- String matchedValue=termMatches(e.currentItem().getItem(),e.getEvaluation().getStemming());
- boolean matches=matchedValue!=null && labelMatches(e.currentItem().getItem(),e);
+ String matchedValue = termMatches(e.currentItem().getItem(), e.getEvaluation().getStemming());
+ boolean matches = matchedValue!=null && labelMatches(e.currentItem().getItem(), e);
if ((matches && !e.isInNegation() || (!matches && e.isInNegation()))) {
- e.addMatch(e.currentItem(),matchedValue);
+ e.addMatch(e.currentItem(), matchedValue);
e.setValue(term);
e.next();
}
@@ -58,11 +56,11 @@ public class TermCondition extends Condition {
}
/** Returns a non-null replacement term if there is a match, null otherwise */
- private String termMatches(TermItem queryTerm,boolean stemming){
- String queryTermString=queryTerm.stringValue();
+ private String termMatches(TermItem queryTerm, boolean stemming) {
+ String queryTermString = queryTerm.stringValue();
// The terms are the same
- boolean matches=queryTermString.equals(term);
+ boolean matches = queryTermString.equals(term);
if (matches) return term;
if (stemming)
@@ -72,14 +70,14 @@ public class TermCondition extends Condition {
}
private boolean termMatchesWithStemming(String queryTermString) {
- if (queryTermString.length()<3) return false; // Don't stem very short terms
+ if (queryTermString.length() < 3) return false; // Don't stem very short terms
// The query term minus s is the same
- boolean matches=queryTermString.equals(termPlusS);
+ boolean matches = queryTermString.equals(termPlusS);
if (matches) return true;
// The query term plus s is the same
- matches=term.equals(queryTermString + "s");
+ matches = term.equals(queryTermString + "s");
if (matches) return true;
return false;
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 4513050ebfb..847014ff646 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
@@ -15,28 +15,28 @@ import com.yahoo.protect.Validator;
public abstract class TermProduction extends Production {
/** The label of this term, or null if none */
- private String label=null;
+ private String label = null;
/** The type of term to produce */
private TermType termType;
/** Creates a produced template term with no label and the default type */
public TermProduction() {
- this(null,TermType.DEFAULT);
+ this(null, TermType.DEFAULT);
}
/** Creates a produced template term with the default term type */
public TermProduction(String label) {
- this(label,TermType.DEFAULT);
+ this(label, TermType.DEFAULT);
}
/** Creates a produced template term with no label */
public TermProduction(TermType termType) {
- this(null,termType);
+ this(null, termType);
}
public TermProduction(String label, TermType termType) {
- this.label=label;
+ this.label = label;
setTermType(termType);
}
@@ -52,14 +52,14 @@ public abstract class TermProduction extends Production {
/** Sets the term type to produce */
public void setTermType(TermType termType) {
Validator.ensureNotNull("Type of produced Term",termType);
- this.termType=termType;
+ this.termType = termType;
}
/**
* Inserts newItem at the position of this match
* TODO: Move to ruleevaluation
*/
- protected void insertMatch(RuleEvaluation e,Match matched, Item newItem,int offset) {
+ protected void insertMatch(RuleEvaluation e, Match matched, Item newItem, int offset) {
newItem.setWeight(getWeight());
int insertPosition=matched.getPosition()+offset;
@@ -76,13 +76,13 @@ public abstract class TermProduction extends Production {
}
protected String getLabelString() {
- if (label==null) return "";
+ if (label == null) return "";
return label + ":";
}
/** All instances of this produces a parseable string output */
public final String toInnerString() {
- if (termType==null)
+ if (termType == null)
return toInnerTermString();
else
return termType.toSign() + toInnerTermString();