static void prepare_data(void) { create_documents_table(); create_terms_table(); insert_data(); }
void test_match_without_index(void) { grn_obj *v; create_properties_table(); create_documents_table(); insert_data(); cut_assert_not_null((cond = grn_expr_create(&context, NULL, 0))); v = grn_expr_add_var(&context, cond, NULL, 0); GRN_RECORD_INIT(v, 0, grn_obj_id(&context, docs)); grn_expr_append_obj(&context, cond, v, GRN_OP_PUSH, 1); GRN_TEXT_SETS(&context, &text_buf, "body"); grn_expr_append_const(&context, cond, &text_buf, GRN_OP_PUSH, 1); grn_expr_append_op(&context, cond, GRN_OP_GET_VALUE, 1); GRN_TEXT_SETS(&context, &text_buf, "moge"); grn_expr_append_const(&context, cond, &text_buf, GRN_OP_PUSH, 1); grn_expr_append_op(&context, cond, GRN_OP_MATCH, 2); grn_expr_compile(&context, cond); res = grn_table_create(&context, NULL, 0, NULL, GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, docs, NULL); cut_assert_not_null(res); cut_assert_not_null(grn_table_select(&context, docs, cond, res, GRN_OP_OR)); grn_test_assert_select( &context, gcut_take_new_list_string("moge moge moge", "hoge moge moge moge", "moge hoge hoge", "moge hoge fuga fuga", "moge hoge moge moge moge", "poyo moge hoge moge moge moge", NULL), res, "body"); }