function defaultScript( hits ) {
	var sortingFn = function( a, b ) {
		a.custom_ranking = a.custom_ranking || 0;
		b.custom_ranking = b.custom_ranking || 0;

		if ( a.custom_ranking === b.custom_ranking ) return a.index - b.index;
		if ( a.custom_ranking > b.custom_ranking ) return -1;
		if ( a.custom_ranking < b.custom_ranking ) return 1;
	};

	var result = [];
	var tags = [ '{{{ tags }}}' ];

	var hitsGrouped = { api: [] };

	tags.forEach( function( tag ) {
		hitsGrouped[ tag ] = hits
			.filter( function( h ) {
				return h.tags.includes( '{{{ slug }}}' ) && h.tags.includes( tag );
			} )
			.slice( 0, 10 )
			.map( function( item, idx ) {
				item.index = idx;
				return item;
			} )
			.sort( sortingFn )
			.slice( 0, 3 );
	} );

	var apiSearchHits = [];

	if ( window.apiSearch ) apiSearchHits = window.apiSearch();

	hitsGrouped.api = hitsGrouped.api.filter( function( h ) {
		var isDuplicated = false;

		for ( var i = 0; i < apiSearchHits.length; i++ ) {
			if ( h.url.includes( apiSearchHits[ i ].urlShort ) ) {
				isDuplicated = true;
				break;
			}
		}

		return !isDuplicated;
	} );

	hitsGrouped.api = ( apiSearchHits || [] ).concat( hitsGrouped.api );

	tags.forEach( function( tag ) {
		result = result.concat( hitsGrouped[ tag ].slice( 0, 4 ) );
	} );

	return result;
}
