In the screenshot I noticed that you're using my Debug Toolbar to list the contents of the viewScope, so I had a look at the source code of it to make sure that that wasn't the problem. It does do some sorting when dumping an object, but only for the object's properties, not the order of the objects.
Looks like you're using the TemplateSearch method written by Tommy Valand. That script performs a sort function too on the results (the JSON array) based on parameters in the viewScope:
var jsonValuesSorted = Lookup.sortJSONArray( jsonValues, viewScope.get(sortScopeName), viewScope.get(sortScopeName2), viewScope.get(sortScopeDirection));
Are those values set at all? It might be that it doesn't sort when they're not available.
Another issue might be the order in which values are read from/ stored in the viewScope causing the differences. You might want add a dump of the search results to the toolbar right after they're retrieved (in the "value" attribute of the repeat) using:
dBar.dump( viewScope.jsonValuesPortfolio );
or do a
var searchResults = TemplateSearch.search('viewScope', .....);