airborne12 commented on code in PR #69790:
URL: https://github.com/apache/doris/pull/69790#discussion_r4439392091
##########
be/src/storage/index/inverted/reader/collection_statistics.cpp:
##########
@@ -89,6 +98,23 @@ Result<std::shared_ptr<lucene::search::IndexSearcher>>
open_optional_clucene_sta
return std::make_shared<lucene::search::IndexSearcher>(reader, true);
}
+// Whether a SNII segment has no terms for this field: it indexed the field
with BKD, see
+// open_optional_clucene_stats_searcher, or the field is a VARIANT path this
segment does not hold,
+// as segments of {"a": 1} hold no path b. Any other missing index was not
built, and the caller
+// refuses to score the collection without it.
+Result<bool> snii_field_has_no_terms(const segment_v2::IndexFileReader&
file_reader,
+ const TabletIndex& index) {
+ const auto entries = DORIS_TRY(file_reader.snii_logical_indexes());
Review Comment:
Fixed in a66e73d8fa. `snii_field_has_no_terms` now reads the kind of one
entry through `IndexFileReader::snii_logical_index_kind`, which uses the same
`MetadataDirectory::find` lookup as `open_index` under the reader's existing
shared lock, so nothing is copied. `snii_logical_indexes()` stays for
`index_disk_usage`, which needs every entry. Results do not change. Covered by
the new
`SniiSegmentReaderLogicalIndexesTest.FindsDirectoryEntryWithoutCopyingIt`, the
existing SNII missing-path tests, and the BKD and sparse VARIANT cases in
`test_match_keyword_score`.
--
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]