Skip to content
Snippets Groups Projects

Allow sorting by element name

Merged Erwan Rouchet requested to merge search-sort into master

Closes #1375 (closed)

Sorting by element_text was already possible, but since the field was tokenized to allow searching on each word separately, the sorting was yielding incomprehensible results.

I tried to use a CopyField, one of the options offered in the sort documentation, to store the full, unmodified element name alongside the tokenized version. create_copy_field exists, but handling updates to those later on would be much more complex than with regular fields. I used a SortableTextField instead, which handles this storage by itself.

This will require a manage.py reindex --drop to avoid a HTTP 400 by Solr because updating from TextField to SortableTextField does not seem to be possible.

I was slowed down by various issues on the frontend search form, the API client, the API view and the indexer, and will create various follow-up issues later.

@babadie Is #782 (closed) still useful? It could be implemented more quickly now, but it isn't requested anymore.

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Bastien AbadieBastien Abadie 2 years ago (Nov 21, 2022 11:31am UTC)

Merge details

  • Changes merged into with 5ea7fb61.
  • Deleted the source branch.
  • Auto-merge enabled

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading