From 7aeeb190486e98eb1eeb123176b1831edca083f0 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Fri, 14 Jun 2024 17:55:35 +0800 Subject: [PATCH] Shortcut ft matching process with one posting list --- src/Interpreters/GinFilter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Interpreters/GinFilter.cpp b/src/Interpreters/GinFilter.cpp index 5d8233183132..3a1a5fb403e6 100644 --- a/src/Interpreters/GinFilter.cpp +++ b/src/Interpreters/GinFilter.cpp @@ -166,6 +166,10 @@ bool GinFilter::match(const GinPostingsCache & postings_cache) const if (hasEmptyPostingsList(postings_cache)) return false; + /// If there is only one non-empty posting list, it is a match. + if (postings_cache.size() == 1) + return true; + /// Check for each row ID ranges for (const auto & rowid_range: rowid_ranges) if (matchInRange(postings_cache, rowid_range.segment_id, rowid_range.range_start, rowid_range.range_end))