diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/result/ErrorHit.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/result/ErrorHit.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java new file mode 100644 index 00000000000..a3b79d98e65 --- /dev/null +++ b/container-search/src/main/java/com/yahoo/search/result/ErrorHit.java @@ -0,0 +1,47 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.search.result; + +import java.util.Iterator; +import java.util.Set; + +/** + * A hit which holds information on error conditions in a result. + * En error hit maintains a main error - the main error of the result. + * + * @author bratseth + */ +public interface ErrorHit extends Cloneable { + + void setSource(String source); + + /** Returns the main error of this result, never null */ + @Deprecated // use: errors().iterator().next() + ErrorMessage getMainError(); + + /** + * Adds an error to this. This may change the main error + * and/or the list of detailed errors + */ + void addError(ErrorMessage error); + + /** Add all errors from another error hit to this */ + void addErrors(ErrorHit errorHit); + + /** + * Returns all the detail errors of this error hit, including the main error + */ + Iterator<? extends ErrorMessage> errorIterator(); + + /** Returns a read-only set containing all the error of this, including the main error */ + Set<ErrorMessage> errors(); + + /** Returns true - this is a meta hit containing information on other hits */ + boolean isMeta(); + + /** Returns true if main error is the given error code or if main error + is general error 8 and all suberrors are the given error code */ + boolean hasOnlyErrorCode(int code); + + Object clone(); + +} |