Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Perform case-insensitive sorting #4089

Open
thomasrawiel opened this issue Jun 7, 2024 · 0 comments
Open

[FEATURE] Perform case-insensitive sorting #4089

thomasrawiel opened this issue Jun 7, 2024 · 0 comments

Comments

@thomasrawiel
Copy link

thomasrawiel commented Jun 7, 2024

It's currently not possible to sort results on a case-insensitive basis.

Given the following example: "Sort by page title" - but could be anything really, like extbase record title, news title or similar things.
For example a list of brands, company names, movie titles or similar that can start with lowercase letters or numbers

Indexing the record title

plugin.tx_solr.index.queue.pages.fields {
   pageTitle_stringS = title
}

In the result query sort by the indexed title field

query {
  sortBy = pageTitle_stringS ASC
  filter {
    types = type:pages
    #types = type:tx_myext_domain_model_something
  }
}

results in a correctly sorted list, except that lowercase titles are sorted after uppercase titles.
For example
expecting A, a, B, b, C, c, D, d, E, F
but is sorted A, B, C, D, E, F, a, b, c, d

Describe the solution you'd like
Possible solution https://dev.to/cendekia/perform-case-insensitive-sorting-in-solr-6k4

Maybe add an option to switch between case-sensitive and case-insensitive

query {
  sortBy = pageTitle_stringS ASC
  sortByIgnoreCase = 0 #disables case-insensitive sorting
  sortByIgnoreCase = 1 #enables case-insensitive sorting

  filter {
    types = type:pages
  }
}

In my opinion case-insensitive sorting should be the default.

Describe alternatives you've considered
Currently solved by indexing the title field in lowercase:

plugin.tx_solr.index.queue.pages.fields {
   pageTitle_stringS = title

   sortPageTitle_stringS = TEXT
   sortPageTitle_stringS.field = title
   sortPageTitle_stringS.stdWrap.case = lower
}

...

query {
  sortBy = sortPageTitle_stringS ASC
  filter {
    types = type:pages
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant