[Groonga-commit] groonga/groonga at 49d238f [master] grn_ts: enable --scorer

Back to archive index

susumu.yata null+****@clear*****
Thu Nov 12 23:53:02 JST 2015


susumu.yata	2015-11-12 23:53:02 +0900 (Thu, 12 Nov 2015)

  New Revision: 49d238f2a286c6a92e33090c6b22c1931bc79b24
  https://github.com/groonga/groonga/commit/49d238f2a286c6a92e33090c6b22c1931bc79b24

  Message:
    grn_ts: enable --scorer
    
    GitHub: #428

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+11 -3)
===================================================================
--- lib/ts.c    2015-11-12 22:43:40 +0900 (3385ae7)
+++ lib/ts.c    2015-11-12 23:53:02 +0900 (12d890b)
@@ -722,7 +722,10 @@ grn_ts_select_filter(grn_ctx *ctx, grn_obj *table, grn_ts_str str,
 static grn_rc
 grn_ts_select_scorer(grn_ctx *ctx, grn_obj *table, grn_ts_str str,
                      grn_ts_record *records, size_t n_records) {
-  grn_ts_str rest = grn_ts_str_trim_left(str);
+  grn_rc rc;
+  grn_ts_str rest;
+  grn_ts_expr *expr;
+  rest = grn_ts_str_trim_left(str);
   if (!rest.size) {
     return GRN_SUCCESS;
   }
@@ -741,8 +744,13 @@ grn_ts_select_scorer(grn_ctx *ctx, grn_obj *table, grn_ts_str str,
       rest = str;
     }
   }
-  // TODO
-  return GRN_SUCCESS;
+  rc = grn_ts_expr_parse(ctx, table, rest.ptr, rest.size, &expr);
+  if (rc != GRN_SUCCESS) {
+    return rc;
+  }
+  rc = grn_ts_expr_adjust(ctx, expr, records, n_records);
+  grn_ts_expr_close(ctx, expr);
+  return rc;
 }
 
 /* grn_ts_select_output() outputs the results. */
-------------- next part --------------
HTML����������������������������...
Download 



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