All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.inbot.elasticsearch.client.IterableSearchResponse Maven / Gradle / Ivy

package io.inbot.elasticsearch.client;

import com.github.jsonj.JsonObject;
import java.util.Iterator;
import java.util.function.Function;

public class IterableSearchResponse implements SearchResponse {
    private final Iterator results;
    private final int size;

    public IterableSearchResponse(int size, Iterator results) {
        this.size = size;
        this.results = results;
    }

    public IterableSearchResponse(int size, Iterable results) {
        this.size = size;
        this.results = results.iterator();
    }

    @Override
    public ProcessingSearchResponse map(Function f) {
        return ProcessingSearchResponse.map(this, f);
    }

    @Override
    public int size() {
        return size;
    }

    @Override
    public Iterator iterator() {
        return results;
    }

    @Override
    public boolean page() {
        return false;
    }

    @Override
    public PagedSearchResponse getAsPagedResponse() {
        throw new UnsupportedOperationException("not a paged response");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy