Refactoring: Extract code to mangle SearchableText queries into its own function.