diff options
Diffstat (limited to 'document/src/main/java/com/yahoo/document/select/ResultList.java')
-rw-r--r-- | document/src/main/java/com/yahoo/document/select/ResultList.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/document/src/main/java/com/yahoo/document/select/ResultList.java b/document/src/main/java/com/yahoo/document/select/ResultList.java index 8d73c475981..432e86a6c78 100644 --- a/document/src/main/java/com/yahoo/document/select/ResultList.java +++ b/document/src/main/java/com/yahoo/document/select/ResultList.java @@ -116,13 +116,19 @@ public class ResultList { return true; } - public ResultList combineAND(ResultList other) + public interface GetResultList { + ResultList getResult(); + } + + public ResultList combineAND(GetResultList other) { + if (Result.FALSE == toResult()) return ResultList.toResultList(false); + ResultList result = new ResultList(); // TODO: optimize for (ResultPair pair : results) { - for (ResultPair otherPair : other.results) { + for (ResultPair otherPair : other.getResult().results) { FieldPathIteratorHandler.VariableMap varMap = (FieldPathIteratorHandler.VariableMap)pair.variables.clone(); if (combineVariables(varMap, otherPair.variables)) { @@ -144,13 +150,15 @@ public class ResultList { return Result.INVALID; } - public ResultList combineOR(ResultList other) + public ResultList combineOR(GetResultList other) { + if (Result.TRUE == toResult()) return ResultList.toResultList(true); + ResultList result = new ResultList(); // TODO: optimize for (ResultPair pair : results) { - for (ResultPair otherPair : other.results) { + for (ResultPair otherPair : other.getResult().results) { FieldPathIteratorHandler.VariableMap varMap = (FieldPathIteratorHandler.VariableMap)pair.variables.clone(); if (combineVariables(varMap, otherPair.variables)) { |