FTS sorting with keyword analyzer is broken for many words

Hi @aki,

This is sort of a known issue and I would suggest you try the “Sort by Object” option.
ref - Sorting Query Results | Couchbase Docs
You may try the sort field like below,

"sort": [
      {
       "by" : "field",
       "field" : "a",
       "mode" : "max",
       "missing" : "last",
       "type": "string"
      }

The trick is you should explicitly specify the type of the sort field here over the type field.
Since the field “a” is of text type, let’s set the “type” as string in this case.

Cheers!

1 Like