summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-13 11:28:27 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-13 11:28:27 +0200
commit67ea34ceba6ac6496f583d3e1457fd6c1c77538e (patch)
tree191b1a79d8789d0ea1fc3fd73193ec5ee01c6a2d /container-search
parentb409418b183cde062f2ab67d8d96f3079aa334eb (diff)
Error checking in one place and add TODO about verifying if we need to require TermItem.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/query/SameElementItem.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/SameElementItem.java b/container-search/src/main/java/com/yahoo/prelude/query/SameElementItem.java
index 11796b6c97c..4a13d24d953 100644
--- a/container-search/src/main/java/com/yahoo/prelude/query/SameElementItem.java
+++ b/container-search/src/main/java/com/yahoo/prelude/query/SameElementItem.java
@@ -50,6 +50,7 @@ public class SameElementItem extends NonReducibleCompositeItem {
@Override
protected void adding(Item item) {
super.adding(item);
+ //TODO See if we can require only SimpleIndexedItem instead of TermItem
Validator.ensureInstanceOf("Child item", item, TermItem.class);
TermItem asTerm = (TermItem) item;
Validator.ensureNonEmpty("Struct fieldname", asTerm.getIndexName());
@@ -58,7 +59,7 @@ public class SameElementItem extends NonReducibleCompositeItem {
@Override
public Optional<Item> extractSingleChild() {
- if (getItemCount() == 1 && getItem(0) instanceof SimpleIndexedItem) {
+ if (getItemCount() == 1) {
SimpleIndexedItem child = (SimpleIndexedItem)getItem(0);
child.setIndexName(getFieldName() + "." + child.getIndexName());
return Optional.of(child);