When sorting on the field "Title", my client is unhappy that records with a title in quotes, or with leading spaces, will be at the top. I've thought of a few ways around this, but they all have problems. One of the main issues is that this data takes over twenty-four hours to index fully, from scratch, so re-indexing is not a feasible option.
I could use a sorting strategy which ignores the punctuation — but I'm not sure how to do that at query time. I thought of using a script sort with a regex, but as far as I can make out, that isn't possible — we can sort on whether or not a term matches the pattern, but we can't sort on a term as it has been altered by a regex search-and-replace.
I could create a new field, based on the value of the Title field — call it SortTitle — just for sorting. Again, I don't know how to go about this either. I've read so much documentation I feel I know less than when I began. Again, it seems regex can be used as a conditional, but not for calculating the value of a new field based on the value of an old one.