Skip to content

Commit

Permalink
HSEARCH-3846 Code cleanup for sort filters
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Apr 8, 2020
1 parent e048837 commit 9bf31e0
Showing 1 changed file with 4 additions and 7 deletions.
Expand Up @@ -24,7 +24,7 @@
class FieldSortOptionsStepImpl<B>
extends AbstractSortThenStep<B>
implements FieldSortOptionsStep<FieldSortOptionsStepImpl<B>>,
FieldSortMissingValueBehaviorStep<FieldSortOptionsStepImpl<B>> {
FieldSortMissingValueBehaviorStep<FieldSortOptionsStepImpl<B>> {

private final FieldSortBuilder<B> builder;

Expand Down Expand Up @@ -53,10 +53,8 @@ public FieldSortMissingValueBehaviorStep<FieldSortOptionsStepImpl<B>> missing()

@Override
public FieldSortOptionsStepImpl<B> filter(
Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) {

SearchSortDslContext<?, ? super B> ctx = getDslContext();
SearchPredicateBuilderFactory predicateBuilderFactory = ctx.getPredicateBuilderFactory();
Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) {
SearchPredicateBuilderFactory<?, ?> predicateBuilderFactory = getDslContext().getPredicateBuilderFactory();
SearchPredicateFactory factory = new DefaultSearchPredicateFactory<>( predicateBuilderFactory );
SearchPredicate predicate = clauseContributor.apply( extendPredicateFactory( factory ) ).toPredicate();

Expand All @@ -66,8 +64,7 @@ public FieldSortOptionsStepImpl<B> filter(

@Override
public FieldSortOptionsStepImpl<B> filter(SearchPredicate searchPredicate) {
SearchSortDslContext<?, ? super B> ctx = getDslContext();
SearchPredicateBuilderFactory predicateBuilderFactory = ctx.getPredicateBuilderFactory();
SearchPredicateBuilderFactory<?, ?> predicateBuilderFactory = getDslContext().getPredicateBuilderFactory();
searchPredicate = (SearchPredicate) predicateBuilderFactory.toImplementation( searchPredicate );

builder.filter( searchPredicate );
Expand Down

0 comments on commit 9bf31e0

Please sign in to comment.