Add sort attributes to the list of attributes for distributed search requests
Fix syntax error: missing do
Handle nil attributes and sortKeys correctly