Class DelegatingSearchSortFactory<PDF extends SearchPredicateFactory>

    • Method Detail

      • score

        public ScoreSortOptionsStep<?> score()
        Description copied from interface: SearchSortFactory
        Order elements by their relevance score.

        The default order is descending, i.e. higher scores come first.

        Specified by:
        score in interface SearchSortFactory
        Returns:
        A DSL step where the "score" sort can be defined in more details.
      • indexOrder

        public SortThenStep indexOrder()
        Description copied from interface: SearchSortFactory
        Order elements by their internal index order.
        Specified by:
        indexOrder in interface SearchSortFactory
        Returns:
        A DSL step where the "index order" sort can be defined in more details.
      • composite

        public SortThenStep composite​(Consumer<? super CompositeSortComponentsStep<?>> elementContributor)
        Description copied from interface: SearchSortFactory
        Order by a sort composed of several elements, which will be defined by the given consumer.

        Best used with lambda expressions.

        This is mainly useful to mix imperative and declarative style when building sorts, e.g.:

        
         f.composite( c -> {
            c.add( f.field( "category" ) );
            if ( someInput != null ) {
                c.add( f.distance( "location", someInput.getLatitude(), someInput.getLongitude() );
            }
            c.add( f.indexOrder() );
         } )
         
        Specified by:
        composite in interface SearchSortFactory
        Parameters:
        elementContributor - A consumer that will add clauses to the step passed in parameter. Should generally be a lambda expression.
        Returns:
        A DSL step where the "composite" sort can be defined in more details.
      • extension

        public <T> T extension​(SearchSortFactoryExtension<T> extension)
        Description copied from interface: SearchSortFactory
        Extend the current factory with the given extension, resulting in an extended factory offering different types of sorts.
        Specified by:
        extension in interface SearchSortFactory
        Type Parameters:
        T - The type of factory provided by the extension.
        Parameters:
        extension - The extension to the sort DSL.
        Returns:
        The extended factory.