com.algolia.search.iterators.IndexIterable Maven / Gradle / Ivy
The newest version!
package com.algolia.search.iterators;
import com.algolia.search.SearchIndex;
import com.algolia.search.models.RequestOptions;
import com.algolia.search.models.indexing.BrowseIndexQuery;
import java.util.Iterator;
import java.util.Objects;
import javax.annotation.Nonnull;
@SuppressWarnings("WeakerAccess")
public class IndexIterable implements Iterable {
private final SearchIndex index;
private final BrowseIndexQuery query;
private final RequestOptions requestOptions;
public IndexIterable(@Nonnull SearchIndex index) {
this(index, new BrowseIndexQuery());
}
public IndexIterable(@Nonnull SearchIndex index, @Nonnull BrowseIndexQuery query) {
this(index, query, null);
}
public IndexIterable(
@Nonnull SearchIndex index,
@Nonnull BrowseIndexQuery query,
RequestOptions requestOptions) {
Objects.requireNonNull(index, "Index is required");
Objects.requireNonNull(query, "Query is required");
this.index = index;
this.query = query;
this.requestOptions = requestOptions;
}
@Override
@Nonnull
public Iterator iterator() {
return new IndexIterator<>(index, query, requestOptions);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy