airborne12 commented on code in PR #71118:
URL: https://github.com/apache/doris/pull/71118#discussion_r4731759830


##########
be/src/storage/index/inverted/common/query_info.h:
##########
@@ -40,4 +40,11 @@ class TermInfo {
     }
 };
 
+// The name BM25 statistics of a MATCH are kept under. Two indexes of one 
column hold different
+// terms and lengths under the same field, so the field alone cannot key them: 
over Apple and
+// apple, an index that folds case has df(apple) = 2 and one that does not has 
df(apple) = 1.
+inline std::wstring match_statistics_field(const std::wstring& field, int64_t 
index_id) {
+    return field + L"@" + std::to_wstring(index_id);

Review Comment:
   Fixed on master in #71123 and picked here as add9c162f7a. A MATCH statistics 
name is now `@<index_id>@<field>`. Every field name starts with the column 
unique id, so no SEARCH field, including a VARIANT key such as `key@2004`, can 
equal it, and the index id still keeps two indexes of one column apart. New 
tests: `CollectionStatisticsTest.MatchStatisticsFieldIsNeverAFieldName` and 
`MatchAndSearchOnLookalikeVariantKeysKeepSeparateStatistics` (a MATCH on 
`v.key` and a SEARCH on `v.key@2004` through parent index 2004). Both failed 
before the fix, the second with the `[E-6001] ... 2004 and 2004` error you 
described, and both pass after it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to