Skip to content

search: add support for custom string sort ordering#2356

Open
Vishhh03 wants to merge 1 commit into
blevesearch:masterfrom
Vishhh03:feature/custom-sort-ordering
Open

search: add support for custom string sort ordering#2356
Vishhh03 wants to merge 1 commit into
blevesearch:masterfrom
Vishhh03:feature/custom-sort-ordering

Conversation

@Vishhh03

Copy link
Copy Markdown

Fixes #2223

The custom sort func within SearchRequest only sorts the value after the collector picks up during phase 1, ie. Custom sort function only runs in phase 2 after the data has been sorted normally.

  1. Added an Interface that SearchSort can implement
  2. Added a custom function field to search.SortField
  3. Implement the custom function interface on SortField which is json excluded for serialization
  4. Update sortOrder.Compare to conditionally use the custom function if implemented
  5. Added a new unit test TestSortOrderCustomCompare to existing search/sort_test.go file to verify the custom sort functionality

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

Successfully merging this pull request may close these issues.

Use custom strings ordering when sorting

1 participant