Sort queries for photos and events