Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
FIX: missing parameter in prepareScrollingSpliterator
Browse files Browse the repository at this point in the history
  • Loading branch information
lucboruta committed Nov 12, 2018
1 parent 25f69ea commit cf089c0
Showing 1 changed file with 30 additions and 45 deletions.
75 changes: 30 additions & 45 deletions src/com/thunken/sandow/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,37 @@
* A collection backed by an Elasticsearch index.
*
* <p>
* A note on terminology: this interface bridges the Java Collections Framework
* (where a <i>collection</i> represents a group of objects known as its
* <i>elements</i>) and Elasticsearch (where an <i>index</i> represents a group
* of objects known as <i>documents</i>). The code and the documentation of this
* interface use the terminology of the Java Collections Framework.
* A note on terminology: this interface bridges the Java Collections Framework (where a <i>collection</i> represents a
* group of objects known as its <i>elements</i>) and Elasticsearch (where an <i>index</i> represents a group of objects
* known as <i>documents</i>). The code and the documentation of this interface use the terminology of the Java
* Collections Framework.
*
* <p>
* Design principles:
* <ul>
* <li>Interoperability: this interface puts no bounds on the type argument
* {@code <E>};
* <li>Minimalism: this interface provides reasonable implementations for most
* methods using default methods rather than companion abstract classes.
* <li>Interoperability: this interface puts no bounds on the type argument {@code <E>};
* <li>Minimalism: this interface provides reasonable implementations for most methods using default methods rather than
* companion abstract classes.
* </ul>
*
* <p>
* An index contains no duplicate elements. More formally, an index contains no
* pair of elements <code>e1</code> and <code>e2</code> such that
* <code>index.getId(e1).equals(index.getId(e2))</code>. Additionally, an index
* does not allow null elements.
* An index contains no duplicate elements. More formally, an index contains no pair of elements <code>e1</code> and
* <code>e2</code> such that <code>index.getId(e1).equals(index.getId(e2))</code>. Additionally, an index does not allow
* null elements.
*
* <p>
* Contrary to what is still possible as of Elasticsearch 5.4, this class
* removes support for querying multiple types in a single index. More
* precisely, an {@code Index} contains elements of a single type {@code <E>}
* (see <a href="https://www.elastic.co/blog/index-vs-type">Index vs. Type</a>
* and <a href="https://github.com/elastic/elasticsearch/issues/15613">Remove
* support for types?</a> for discussions of the issue). Attempting to query the
* presence of an ineligible element shall throw an exception, typically
* {@link NullPointerException} or {@link ClassCastException}. Furthermore, by
* default, the name of the index in Elasticsearch shall be equal to the
* elements' type in the index, which is itself derived from the lowercased
* Contrary to what is still possible as of Elasticsearch 5.4, this class removes support for querying multiple types in
* a single index. More precisely, an {@code Index} contains elements of a single type {@code <E>} (see
* <a href="https://www.elastic.co/blog/index-vs-type">Index vs. Type</a> and
* <a href="https://github.com/elastic/elasticsearch/issues/15613">Remove support for types?</a> for discussions of the
* issue). Attempting to query the presence of an ineligible element shall throw an exception, typically
* {@link NullPointerException} or {@link ClassCastException}. Furthermore, by default, the name of the index in
* Elasticsearch shall be equal to the elements' type in the index, which is itself derived from the lowercased
* {@link Class#getSimpleName()} of the elements' class.
*
* @implSpec The default method implementations do not apply any synchronization
* protocol, and all operations performed with a {@code Client} are
* asynchronous by nature. If an {@code Index} implementation has a
* specific synchronization protocol, then it must override default
* implementations to apply that protocol.
* @implSpec The default method implementations do not apply any synchronization protocol, and all operations performed
* with a {@code Client} are asynchronous by nature. If an {@code Index} implementation has a specific
* synchronization protocol, then it must override default implementations to apply that protocol.
*
* @param <E>
* the type of elements in this collection
Expand Down Expand Up @@ -203,11 +195,9 @@ default Optional<E> get(@NonNull final String elementId) {
C getClient();

/**
* Return the {@code Class} object representing the element type of this
* collection.
* Return the {@code Class} object representing the element type of this collection.
*
* @return the {@code Class} object representing the element type of this
* collection
* @return the {@code Class} object representing the element type of this collection
*/
Class<E> getElementClass();

Expand All @@ -220,8 +210,7 @@ default Optional<GetField> getField(@NonNull final String elementId, @NonNull fi
* Return the unique {@code String} ID of the given element.
*
* @param element
* an object of type {@code <E>}, that may or may not be part of
* this collection
* an object of type {@code <E>}, that may or may not be part of this collection
* @return the unique id of the given element
*/
String getId(@NonNull E element);
Expand Down Expand Up @@ -251,8 +240,7 @@ default Optional<ByteSizeValue> getSize(@NonNull final String elementId) {
/**
* Return the type of this collection's elements in Elasticsearch.
*
* @implSpec The default implementation gets the return value from the
* lowercased {@link Class#getSimpleName()} of
* @implSpec The default implementation gets the return value from the lowercased {@link Class#getSimpleName()} of
* {@link Index#getElementClass()}.
*
* @return the name of this collection's elements in Elasticsearch
Expand All @@ -267,11 +255,9 @@ default OptionalLong getVersion(@NonNull final String elementId) {
}

/**
* Return the content type of data returned by {@link Index#serialize} and
* consumed by {@link Index#deserialize}.
* Return the content type of data returned by {@link Index#serialize} and consumed by {@link Index#deserialize}.
*
* @return the content type of data returned by {@link Index#serialize} and
* consumed by {@link Index#deserialize}
* @return the content type of data returned by {@link Index#serialize} and consumed by {@link Index#deserialize}
*/
XContentType getXContentType();

Expand Down Expand Up @@ -351,7 +337,7 @@ default RefreshRequestBuilder prepareRefresh() {
}

default ScrollingSearchHitSpliterator.ScrollingSearchHitSpliteratorBuilder prepareScrollingSpliterator() {
return ScrollingSearchHitSpliterator.builder().scroll(getScroll()).size(getPageSize());
return ScrollingSearchHitSpliterator.builder().client(getClient()).scroll(getScroll()).size(getPageSize());
}

default SearchRequestBuilder prepareSearch() {
Expand Down Expand Up @@ -436,13 +422,12 @@ default Stream<E> stream() {
}

/**
* Returns a sequential {@code Stream} with a subset of this collection as
* its source, namely the elements that match the given search query.
* Returns a sequential {@code Stream} with a subset of this collection as its source, namely the elements that
* match the given search query.
*
* @param queryBuilder
* the search query to execute
* @return a sequential {@code Stream} over the elements in this collection
* that
* @return a sequential {@code Stream} over the elements in this collection that
*/
default Stream<E> stream(final QueryBuilder queryBuilder) {
return streamSearchHits(queryBuilder).map(this::deserializeOrEmpty).filter(Optional::isPresent)
Expand Down

0 comments on commit cf089c0

Please sign in to comment.