hello-stephen commented on code in PR #71118:
URL: https://github.com/apache/doris/pull/71118#discussion_r4730937349


##########
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:
   [P2] Keep MATCH statistics keys disjoint from SEARCH fields
   
   SEARCH still keys statistics by the raw physical field, and `@` is legal in 
VARIANT keys. With parent index ID 2004 and keys `x` and `x@2004`, a score 
query combining `CAST(v['x'] AS STRING) MATCH 'apple'` with 
`SEARCH('v.x@2004:apple')` makes both collectors use `U.v.x@2004` (U is the 
column ID). The second collector then fails `validate_same_physical_index` 
because the index suffixes differ, rejecting a query that had distinct keys on 
the base. Use a structured key or encode both namespaces so a raw SEARCH field 
cannot alias a MATCH key.



-- 
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