Fixed incorrect application of ToLowerInvariant()

Sort field should be lowercased when creating the Lucene Sort object,
not when checking if the string has a value.