diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java b/container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java index 49189198c28..b6b84c4b276 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/BoolItem.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.query; import com.yahoo.processing.IllegalInputException; @@ -7,6 +7,8 @@ import java.nio.ByteBuffer; /** * A true/false term suitable for searching bool indexes. + * + * @author bratseth */ public class BoolItem extends TermItem { @@ -58,11 +60,11 @@ public class BoolItem extends TermItem { } private boolean toBoolean(String stringValue) { - switch (stringValue.toLowerCase()) { - case "true" : return true; - case "false" : return false; - default: throw new IllegalInputException("Expected 'true' or 'false', got '" + stringValue + "'"); - } + return switch (stringValue.toLowerCase()) { + case "true" -> true; + case "false" -> false; + default -> throw new IllegalInputException("Expected 'true' or 'false', got '" + stringValue + "'"); + }; } /** Returns the same as stringValue */ |