One level up manager and one level down for subordinates in search results?

How do I get one level up with manager and one level down for subordinates in search results?

I found this page which gives only one level up with manager only but I need sub-ordinates too.
Any help is appreciated. Thanks.

Hello, @vijibhas

You can use the following code. As usual, JS methods and events are gotten from this article of documentation. The code works a bit slow so an item that should be hidden pops up for a second.

//When search results are rendered
renderer.onSearchResultRendered(
    function(event, searchResult, itemData){
        //Get current user
        renderer.dataProvider.getCurrentUserAccountName(function (accountName) {
            //Get an object with data of the current user
            renderer.dataProvider.getBoxGroupItemDataById(accountName, function (dataItem) {
                //Change style if it is not the current user or it has not the current user as a manager or it is not the manager of the current user
                if(!(itemData.AccountName == dataItem.Id || itemData.Manager == dataItem.Id || itemData.AccountName == dataItem.ParentId)){
                    searchResult.$elem.css({ 'display': 'none' });
                }
            });
        });     
    }
);