summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-05-08 16:02:08 +0200
committerGitHub <noreply@github.com>2018-05-08 16:02:08 +0200
commita6e03072aea85d3595755d4dc3fb885d60ba85d6 (patch)
treec54accd33c4d113ccc1571467c6fc308be4a0e8e /container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
parent9282c9bacd7b2d09e55552d44f1ec9d8ebceb610 (diff)
Revert "Revert "Bratseth/lazy summary decoding""
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
index d50006fb82c..e20340a03c0 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/DocsumDefinition.java
@@ -11,6 +11,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* A docsum definition which knows how to decode a certain class of document
@@ -66,9 +67,15 @@ public class DocsumDefinition {
return fields.get(fieldIndex);
}
- /** Returns the index of a field name */
- public Integer getFieldIndex(String fieldName) {
- return fieldNameToIndex.get(fieldName);
+ /** Returns the field with this name, or null if none */
+ public DocsumField getField(String fieldName) {
+ Integer index = fieldNameToIndex.get(fieldName);
+ if (index == null) return null;
+ return getField(index);
+ }
+
+ public Set<String> fieldNames() {
+ return fieldNameToIndex.keySet();
}
@Override