@@ -12435,6 +12435,7 @@ bool flecs_filter_match_table(
1243512435 if (first && match_index) {
1243612436 match_count *= match_index;
1243712437 }
12438+
1243812439 if (match_indices) {
1243912440 match_indices[t_i] = match_index;
1244012441 }
@@ -13295,10 +13296,16 @@ bool ecs_filter_next_instanced(
1329513296 }
1329613297
1329713298 /* Match the remainder of the terms */
13299+ int32_t skip_term = pivot_term;
13300+ if (ecs_id_is_wildcard(filter->terms[pivot_term].id)) {
13301+ skip_term = -1;
13302+ iter->matches_left = 1;
13303+ }
13304+
1329813305 match = flecs_filter_match_table(world, filter, table,
1329913306 it->ids, it->columns, it->sources,
1330013307 it->match_indices, &iter->matches_left, first,
13301- pivot_term , it->flags);
13308+ skip_term , it->flags);
1330213309 if (!match) {
1330313310 it->table = table;
1330413311 iter->matches_left = 0;
@@ -13343,8 +13350,19 @@ bool ecs_filter_next_instanced(
1334313350 column = -column;
1334413351 }
1334513352
13353+ int32_t t, term_count = filter->term_count;
13354+ ecs_term_t *term = NULL;
13355+ for (t = 0; t < term_count; t ++) {
13356+ if (filter->terms[t].field_index == i) {
13357+ term = &filter->terms[t];
13358+ break;
13359+ }
13360+ }
13361+
13362+ ecs_assert(term != NULL, ECS_INTERNAL_ERROR, NULL);
13363+
1334613364 it->columns[i] = column + 1;
13347- flecs_term_match_table(world, &filter->terms[i] , table,
13365+ flecs_term_match_table(world, term , table,
1334813366 &it->ids[i], &it->columns[i], &it->sources[i],
1334913367 &it->match_indices[i], false, it->flags);
1335013368
0 commit comments