pgj opened a new pull request, #5865: URL: https://github.com/apache/couchdb/pull/5865
In the Explain output, bookmarks for queries on `text` (Search) indexes are added in their unpacked format to the options. This leads to at least two problems: - it is inconsistent with how empty bookmarks are rendered for `json` indexes, where the string `"nil"` is used, - for non-trivial bookmarks, contents cannot be translated by `jiffy:encode/1` to a JSON representation so that it will crash. Mitigate this issue by capturing these unpacked bookmarks in the query options and pack them before sending them for building the JSON response. Thanks @mojito317 for reporting this issue! ## Testing recommendations The change comes with tests that may be run as follows. ``` make elixir EXUNIT_OPTS="test/elixir/test/mango/02_basic_find_test.exs test/elixir/test/partition_mango_test.exs" ``` and ``` make elixir-search EXUNIT_OPTS="test/elixir/test/mango/06_basic_text_test.exs test/elixir/test/partition_mango_test.exs" ``` Otherwise just try to start a `_find` query on a `text` index, grab the bookmark, and feed it into an `_explain` request with the same query. It should not crash any more. When running a `_explain` query on a `text` with no bookmark provided, the `opts` field in the body should show `nil` instead of an empty array as it did previously. ## Checklist - [x] Code is written and works correctly - [x] Changes are covered by tests -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
