private function buildSortOrder(SortOrderInterface $sortOrder)
    {
        $sortField = $sortOrder->getField();

        $sortOrderConfig = ['order' => $sortOrder->getDirection()];

        if ($sortField !== SortOrderInterface::DEFAULT_SORT_FIELD) {
            $sortOrderConfig['missing']       = $sortOrder->getMissing();
            $sortOrderConfig['unmapped_type'] = FieldInterface::FIELD_TYPE_KEYWORD;
        }

        if ($sortOrder->getType() == SortOrderInterface::TYPE_NESTED) {
            $sortOrderConfig['nested_path']   = $sortOrder->getNestedPath();
            $sortOrderConfig['mode']          = $sortOrder->getScoreMode();

            if ($sortOrder->getNestedFilter()) {
                $sortOrderConfig['nested_filter'] = $this->queryBuilder->buildQuery($sortOrder->getNestedFilter());
            }
        }

        return [$sortField => $sortOrderConfig];
    }
private function buildSortOrder(SortOrderInterface $sortOrder)
    {
        $sortField = $sortOrder->getField();

        $sortOrderConfig = ['order' => $sortOrder->getDirection()];

        if ($sortField !== SortOrderInterface::DEFAULT_SORT_FIELD) {
            $sortOrderConfig['missing']       = $sortOrder->getMissing();
            $sortOrderConfig['unmapped_type'] = FieldInterface::FIELD_TYPE_KEYWORD;
        }

        if ($sortOrder->getType() == SortOrderInterface::TYPE_NESTED) {
            $sortOrderConfig['nested_path']   = $sortOrder->getNestedPath();
            $sortOrderConfig['mode']          = $sortOrder->getScoreMode();

            if ($sortOrder->getNestedFilter()) {
                $sortOrderConfig['nested_filter'] = $this->queryBuilder->buildQuery($sortOrder->getNestedFilter());
            }
        }

        return [$sortField => $sortOrderConfig];
    }
private function buildSortOrder ( SortOrderInterface $ sortOrder ) { $ sortField = $ sortOrder -> getField ( ) ; $ sortOrderConfig = [ 'order' => $ sortOrder -> getDirection ( ) ] ; if ( $ sortField !== SortOrderInterface :: DEFAULT_SORT_FIELD ) { $ sortOrderConfig [ 'missing' ] = $ sortOrder -> getMissing ( ) ; $ sortOrderConfig [ 'unmapped_type' ] = FieldInterface :: FIELD_TYPE_KEYWORD ; } if ( $ sortOrder -> getType ( ) == SortOrderInterface :: TYPE_NESTED ) { $ sortOrderConfig [ 'nested_path' ] = $ sortOrder -> getNestedPath ( ) ; $ sortOrderConfig [ 'mode' ] = $ sortOrder -> getScoreMode ( ) ; if ( $ sortOrder -> getNestedFilter ( ) ) { $ sortOrderConfig [ 'nested_filter' ] = $ this -> queryBuilder -> buildQuery ( $ sortOrder -> getNestedFilter ( ) ) ; } } return [ $ sortField => $ sortOrderConfig ] ; }
Build a sort order ES condition from a SortOrderInterface specification.

@SuppressWarnings(PHPMD.UnusedPrivateMethod)

@param SortOrderInterface $sortOrder Request sort order specification object.

@return array
Build a sort order ES condition from a SortOrderInterface specification .