[MOD-13432] Fix FULLTEXT field metric count#8037
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8037 +/- ##
==========================================
- Coverage 84.01% 83.90% -0.12%
==========================================
Files 365 365
Lines 55097 55167 +70
Branches 14296 14296
==========================================
- Hits 46292 46290 -2
- Misses 8644 8716 +72
Partials 161 161
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/indexer.c
Outdated
|
|
||
| // Update global statistics for fulltext fields after successful indexing | ||
| if (aCtx->numTextFields > 0) { | ||
| FieldsGlobalStats_UpdateTextFieldDocsIndexed(aCtx->numTextFields); |
There was a problem hiding this comment.
Any reason not to just put this in the while loop in writeCurEntries?
What is the exact metric this counter is counting? If it's the amount of entries we write for the text field, I think it can be there
There was a problem hiding this comment.
IIUC, the loop is for terms rather than for each field? We want to count docs per field
There was a problem hiding this comment.
I thought the meaning of this metric is how many times we indexed documents for text fields..
// Total number of documents indexed by each field type
Actually by this description I would think it's something else - one increment per indexed doc, no matter the field count. I know that's not the meaning since you increment in bulkAdd, but it's a bit confusing.
Anyways, we can go with what you defined it to be, if it's the number of fields then you're right. If you wish to change to the number of index entries that would probably make a bit more sense IMHO.
| } | ||
|
|
||
| // Update the number of terms added for metrics | ||
| FieldsGlobalStats_UpdateFieldDocsIndexed(INDEXFLD_T_FULLTEXT, spec->stats.numTerms - prevNumTerms); |
There was a problem hiding this comment.
FULLTEXT metric counts new terms instead of fields indexed
High Severity
The FULLTEXT field metric now tracks new unique terms added rather than text fields indexed. spec->stats.numTerms - prevNumTerms counts only terms that are new to the index; if a term like "hello" already exists from a previous document, it won't increment the counter. This differs from other field types which increment by 1 per field in IndexerBulkAdd. A document with two text fields containing "hello" and "world" would only add 1 to the metric if "hello" was previously indexed, breaking the test expectation of +2 (per field).
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.2
git worktree add -d .worktree/backport-8037-to-8.2 origin/8.2
cd .worktree/backport-8037-to-8.2
git switch --create backport-8037-to-8.2
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.4
git worktree add -d .worktree/backport-8037-to-8.4 origin/8.4
cd .worktree/backport-8037-to-8.4
git switch --create backport-8037-to-8.4
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
* 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)
* 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)
* 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)
* 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)
* 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)
* 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)
…com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
* 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)
* 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)
…com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
…com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
|
/backport |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.8
git worktree add -d .worktree/backport-8037-to-2.8 origin/2.8
cd .worktree/backport-8037-to-2.8
git switch --create backport-8037-to-2.8
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.10
git worktree add -d .worktree/backport-8037-to-2.10 origin/2.10
cd .worktree/backport-8037-to-2.10
git switch --create backport-8037-to-2.10
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.2
git worktree add -d .worktree/backport-8037-to-8.2 origin/8.2
cd .worktree/backport-8037-to-8.2
git switch --create backport-8037-to-8.2
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.4
git worktree add -d .worktree/backport-8037-to-8.4 origin/8.4
cd .worktree/backport-8037-to-8.4
git switch --create backport-8037-to-8.4
git cherry-pick -x 4e09df11613f0369318038f8012b0b3190ab7285 |
* 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)
|
Successfully created backport PR for |
[MOD-13432] Fix FULLTEXT field metric count ([[#8037](https://github.com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
[MOD-13432] Fix FULLTEXT field metric count ([[#8037](https://github.com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
[MOD-13432] Fix FULLTEXT field metric count ([[#8037](https://github.com/RediSearch/RediSearch/issues/8037)](https://github.com/RediSearch/RediSearch/issues/8037)) * 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)
[MOD-13432] Fix FULLTEXT field metric count ([#8037](#8037)) * 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)
Changed search_total_indexing_ops_text_fields metric to count unique terms indexed instead of documents.
Moved the metric update call from fulltextPreprocessor() to Indexer_Add(), after writeCurEntries() completes successfully. This ensures the metric accurately reflects the number of unique terms added to the inverted index, persisting even after document deletion.
Note
Adjusts field indexing metrics to be accurate and consistent across types.
fulltextPreprocessortowriteCurEntries()and increment by new unique terms (spec->stats.numTermsdelta)FieldsGlobalStats_UpdateFieldDocsIndexedto acceptFieldType(wasFieldSpec*); update all call sitestest_total_terms_indexed_text_fields, update overlapping-index and same-type-field cases, and add JSON NULL field coverageWritten by Cursor Bugbot for commit 29d1782. This will update automatically on new commits. Configure here.