Skip to content

Support for lists when fetching the value of a runtime field that contains multiple values #3076

Closed
@dimitra-konstantinidou

Description

@dimitra-konstantinidou

We have a runtime field that contains multiple string values. Currently the getFieldValue method returns only the first value of the field. Could you please provide support for returning lists as well?

Thank you.

public interface SearchDocument extends Document {
    float getScore();

    Map<String, List<Object>> getFields();

    @Nullable
    default <V> V getFieldValue(final String name) {
        List<Object> values = (List)this.getFields().get(name);
        return (V)(values != null && !values.isEmpty() ? values.get(0) : null);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions