summaryrefslogtreecommitdiff
path: root/src/cursor/cur_index.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cursor/cur_index.c')
-rw-r--r--src/cursor/cur_index.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/cursor/cur_index.c b/src/cursor/cur_index.c
index 0ab992bc88c..6fc01c0421f 100644
--- a/src/cursor/cur_index.c
+++ b/src/cursor/cur_index.c
@@ -240,7 +240,17 @@ __curindex_search(WT_CURSOR *cursor)
found_key = child->key;
if (found_key.size < cursor->key.size)
WT_ERR(WT_NOTFOUND);
- found_key.size = cursor->key.size;
+
+ /*
+ * Custom collators expect to see complete keys, pass an item containing
+ * all the visible fields so it unpacks correctly.
+ */
+ if (cindex->index->collator != NULL &&
+ !F_ISSET(cursor, WT_CURSTD_RAW_SEARCH))
+ WT_ERR(__wt_struct_repack(session, child->key_format,
+ cindex->iface.key_format, &child->key, &found_key));
+ else
+ found_key.size = cursor->key.size;
WT_ERR(__wt_compare(
session, cindex->index->collator, &cursor->key, &found_key, &cmp));
@@ -307,8 +317,18 @@ __curindex_search_near(WT_CURSOR *cursor, int *exact)
* so we flip the sign of the result to match what callers expect.
*/
found_key = child->key;
- if (found_key.size > cursor->key.size)
- found_key.size = cursor->key.size;
+ if (found_key.size > cursor->key.size) {
+ /*
+ * Custom collators expect to see complete keys, pass an item
+ * containing all the visible fields so it unpacks correctly.
+ */
+ if (cindex->index->collator != NULL)
+ WT_ERR(__wt_struct_repack(session,
+ cindex->child->key_format, cindex->iface.key_format,
+ &child->key, &found_key));
+ else
+ found_key.size = cursor->key.size;
+ }
WT_ERR(__wt_compare(
session, cindex->index->collator, &cursor->key, &found_key, exact));
@@ -520,8 +540,8 @@ __wt_curindex_open(WT_SESSION_IMPL *session,
WT_ERR(__curindex_open_colgroups(session, cindex, cfg));
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON))
- __wt_json_column_init(
- cursor, table->key_format, &idx->colconf, &table->colconf);
+ __wt_json_column_init(cursor, uri, table->key_format,
+ &idx->colconf, &table->colconf);
if (0) {
err: WT_TRET(__curindex_close(cursor));