[Groonga-commit] groonga/groonga at e444bdb [master] grn_ts: use grn_ts_table_get_key() instead of grn_table_get_key2()

Back to archive index

susumu.yata null+****@clear*****
Fri Sep 4 08:15:24 JST 2015


susumu.yata	2015-09-04 08:15:24 +0900 (Fri, 04 Sep 2015)

  New Revision: e444bdb16925637edd5cd382d82c3387db1d7f28
  https://github.com/groonga/groonga/commit/e444bdb16925637edd5cd382d82c3387db1d7f28

  Message:
    grn_ts: use grn_ts_table_get_key() instead of grn_table_get_key2()
    
    GitHub: #391

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+10 -3)
===================================================================
--- lib/ts.c    2015-09-03 23:06:59 +0900 (bfef4c8)
+++ lib/ts.c    2015-09-04 08:15:24 +0900 (a50b3d3)
@@ -907,9 +907,16 @@ grn_ts_expr_key_node_evaluate(grn_ctx *ctx, grn_ts_expr_key_node *node,
       grn_ts_text *out_ptr = (grn_ts_text *)out;
       GRN_BULK_REWIND(&node->buf);
       for (i = 0; i < n_in; i++) {
-        /* TODO: Detect an error. */
-        out_ptr[i].size = grn_table_get_key2(ctx, node->table, in[i].id,
-                                             &node->buf);
+        const char *key;
+        size_t key_size;
+        key = (const char *)grn_ts_table_get_key(ctx, node->table, in[i].id,
+                                                 &key_size);
+        if (key && key_size) {
+          grn_rc rc = grn_bulk_write(ctx, &node->buf, key, key_size);
+          if (rc == GRN_SUCCESS) {
+            out_ptr[i].size = key_size;
+          }
+        }
       }
       buf_ptr = GRN_BULK_HEAD(&node->buf);
       for (i = 0; i < n_in; i++) {
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index