github-actions[bot] commented on code in PR #67180:
URL: https://github.com/apache/doris/pull/67180#discussion_r3868272817


##########
be/src/storage/index/inverted/inverted_index_reader.cpp:
##########
@@ -477,7 +477,11 @@ Status FullTextIndexReader::query(const 
IndexQueryContextPtr& context,
             RETURN_IF_ERROR(match_index_search(context, query_type, 
query_info, *searcher_ptr,
                                                term_match_bitmap));
             term_match_bitmap->runOptimize();
-            cache->insert(cache_key, term_match_bitmap, &cache_handler);
+            // A bitmap produced under a candidate restriction is partial and
+            // must never be cached as the full-segment result.
+            if (context->candidate_rows == nullptr) {

Review Comment:
   [P2] Only skip cache insertion when this query actually consumed the 
candidate. `candidate_rows` is published for every fulltext evaluation once the 
scan is below the ratio, but only multi-term phrase/phrase-prefix joins it. 
MATCH_ANY, MATCH_ALL/EQUAL, regexp/phrase-edge, and single-term phrase/prefix 
still compute a full-segment bitmap; after a cold miss this guard nevertheless 
refuses to cache it, so repeated selective scans re-decode the same full 
postings forever. Please carry an explicit per-result 
candidate-consumed/partial-result signal (or otherwise gate on the executed 
query shape) and add a cold-miss/second-hit test for a non-consuming query 
alongside the partial phrase-cache test.



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