Skip to content

[8.6] [MOD-13432] Fix FULLTEXT field metric count#8086

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8037-to-8.6
Jan 19, 2026
Merged

[8.6] [MOD-13432] Fix FULLTEXT field metric count#8086
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8037-to-8.6

Conversation

@redisearch-backport-pull-request
Copy link
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Jan 19, 2026

Description

Backport of #8037 to 8.6.


Note

Refines global indexing metrics and aligns API/INFO/tests.

  • Change FieldsGlobalStats_UpdateFieldDocsIndexed to take FieldType and update all call sites
  • For FULLTEXT, increment metric by new unique terms per document (indexer.c uses spec->stats.numTerms delta); remove redundant doc-level increment
  • Clarify INFO metrics: "total_indexing_ops_*" now denote per-field operations (docs may be counted multiple times); update descriptions
  • Update tests: remove TEXT from doc-count tests, add dedicated TEXT term-count test, adjust overlapping-index and multi-field cases, ensure JSON NULL fields don’t increment counters, and handle multi-value JSON once per doc
  • Minor includes/cleanup (info/global_stats.h include)

Written by Cursor Bugbot for commit 88d2723. This will update automatically on new commits. Configure here.

* Fix metric full text metric counting

* initialize fieldspec

* Add missing include

* remove redundant lines

* test null fields

* Don't count null text fields

* reset counter

* typo fix

* remove redudant wrapper

* Count terms indexed

* remove extra line

* test text indexing

* fix test

(cherry picked from commit 4e09df1)
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

}

// Update the number of terms added for metrics
FieldsGlobalStats_UpdateFieldDocsIndexed(INDEXFLD_T_FULLTEXT, spec->stats.numTerms - prevNumTerms);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disk-based indexes never update FULLTEXT field metric

Medium Severity

For disk-based indexes (spec->diskSpec is set), the FULLTEXT field metric is never updated. The metric calculation at line 133 uses spec->stats.numTerms - prevNumTerms, but IndexSpec_AddTerm (which increments numTerms) is only called in the non-disk branch (lines 110-112). In the disk branch (lines 105-108), numTerms is never updated, so the delta is always 0. The old code in fulltextPreprocessor called the stats update with 1 for all specs, so this is a regression for disk-based indexes.

Additional Locations (1)

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.01%. Comparing base (b6429aa) to head (88d2723).
⚠️ Report is 2 commits behind head on 8.6.

Additional details and impacted files
@@            Coverage Diff             @@
##              8.6    #8086      +/-   ##
==========================================
- Coverage   84.01%   84.01%   -0.01%     
==========================================
  Files         365      365              
  Lines       55097    55096       -1     
  Branches    14296    14296              
==========================================
- Hits        46291    46289       -2     
- Misses       8645     8646       +1     
  Partials      161      161              
Flag Coverage Δ
flow 84.97% <100.00%> (+0.01%) ⬆️
unit 50.82% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Jan 19, 2026
Merged via the queue into 8.6 with commit f3fd8a3 Jan 19, 2026
51 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request bot deleted the backport-8037-to-8.6 branch January 19, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant