Skip to content

Commit

Permalink
HSEARCH-5133 Start the job
Browse files Browse the repository at this point in the history
  • Loading branch information
fax4ever committed Apr 22, 2024
1 parent 96f0940 commit 0454b2c
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.engine.search.aggregation.dsl;

import java.util.Map;
import java.util.function.Function;

import org.hibernate.search.engine.search.common.ValueConvert;
import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory;

/**
* The initial step in a "sum" aggregation definition, where the target field can be set.
*
* @param <PDF> The type of factory used to create predicates in {@link AggregationFilterStep#filter(Function)}.
*/
public interface SumAggregationFieldStep<PDF extends SearchPredicateFactory> {

/**
* Target the given field in the sum aggregation.
*
* @param fieldPath The <a href="SearchAggregationFactory.html#field-paths">path</a> to the index field to aggregate.
* @param type The type of field values.
* @param <F> The type of field values.
* @return The next step.
*/
default <F> SumAggregationOptionStep<?, PDF, F, Map<F, Long>> field(String fieldPath, Class<F> type) {
return field( fieldPath, type, ValueConvert.YES );
}

/**
* Target the given field in the sum aggregation.
*
* @param fieldPath The <a href="SearchAggregationFactory.html#field-paths">path</a> to the index field to aggregate.
* @param type The type of field values.
* @param <F> The type of field values.
* @param convert Controls how the ranges passed to the next steps and fetched from the backend should be converted.
* See {@link ValueConvert}.
* @return The next step.
*/
<F> SumAggregationOptionStep<?, PDF, F, Map<F, Long>> field(String fieldPath, Class<F> type,
ValueConvert convert);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.engine.search.aggregation.dsl;

import java.util.function.Function;

import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory;

/**
* The final step in a "sum" aggregation definition, where optional parameters can be set.
*
* @param <S> The "self" type (the actual exposed type of this step).
* @param <PDF> The type of factory used to create predicates in {@link #filter(Function)}.
* @param <F> The type of the targeted field.
* @param <A> The type of result for this aggregation.
*/
public interface SumAggregationOptionStep<
S extends SumAggregationOptionStep<?, PDF, F, A>,
PDF extends SearchPredicateFactory,
F,
A>
extends AggregationFinalStep<A>, AggregationFilterStep<S, PDF> {

/**
* @param missing The value to use, in case of the field value is (missing) not present, in place of "null" to compute the sum.
*
* @return {@code this}, for method chaining.
*/
S missing(F missing);

}

0 comments on commit 0454b2c

Please sign in to comment.