Sorting on string is not lexicographical #3006
-
Hi couch team, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Heya, what’s the full URL you are using to make your query? |
Beta Was this translation helpful? Give feedback.
-
@janl Here is the full url I use: and here is the response I get:
So as you see the last_observed is not sorted properly |
Beta Was this translation helpful? Give feedback.
-
Just to clarify: you want to use search and what you try doesn’t work, right? Or are you looking for any way to get docs sorted by date (because a regular view, or even a mango query will do that for you). If search, can you share your design doc? |
Beta Was this translation helpful? Give feedback.
-
Yes, this is almost certainly because the Standard analyzer is treating the ":" as punctuation and the resulting tokenized field doesn't sort the same way as the string would. Echoing @willholley in another forum, you could try using the keyword analyzer for that field. You can use the |
Beta Was this translation helpful? Give feedback.
Yes, this is almost certainly because the Standard analyzer is treating the ":" as punctuation and the resulting tokenized field doesn't sort the same way as the string would.
Echoing @willholley in another forum, you could try using the keyword analyzer for that field. You can use the
_search_analyze
endpoint (https://docs.couchdb.org/en/master/ddocs/search.html#testing-analyzer-tokenization) to test how different analyzers tokenize the value.