CrownChu commented on code in PR #8000: URL: https://github.com/apache/paimon/pull/8000#discussion_r3472170324
########## paimon-eslib/src/main/java/org/apache/paimon/eslib/index/ESIndexGlobalIndexerFactory.java: ########## @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.paimon.eslib.index; + +import org.apache.paimon.globalindex.GlobalIndexer; +import org.apache.paimon.globalindex.GlobalIndexerFactory; +import org.apache.paimon.options.Options; +import org.apache.paimon.types.DataField; + +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * Factory for creating ES multi-index global indexers. Supports vector (DiskBBQ/HNSW/Native), + * fulltext (BM25), and scalar fields. + */ +public class ESIndexGlobalIndexerFactory implements GlobalIndexerFactory { + + public static final String IDENTIFIER = "es-index"; + + private static final String READ_SEARCH_THREADS_KEY = + "global-index.es-index.read-search-threads"; + private static final int DEFAULT_READ_SEARCH_THREADS = -1; + + private static volatile ExecutorService readSearchExecutor; + private static final Object LOCK = new Object(); + + @Override + public String identifier() { + return IDENTIFIER; + } + + @Override + public boolean supportsFullTextSearch() { + // The ES index is a hybrid backend: a FULLTEXT-typed column (whether it is the primary + // index field or an extra field of a multi-column index) is served by Lucene full-text + // search. Without this override FullTextScanImpl filters out every es-index file and the + // planner full-text path returns nothing. + return true; Review Comment: Thanks for pushing on this — I traced the full-text path end-to-end and this does not cause a false negative; the behavior is correct. Full-text is index-only: FullTextScanImpl adds no raw/unindexed split (unlike the vector path's RawVectorSearchSplit/unindexedRanges), so there is no raw split that "coverage" could suppress. FullTextReadImpl unions per-column results (or) and skips Optional.empty(). So an es-index whose queried column has no analyzed (full-text) index just contributes an empty split to the union — it can't hide matches from a real full-text index on the same column/range, and full-text search on a non-analyzed column returns empty, which is the only correct answer. The "no raw split → false negative" reasoning applies to the vector path, not here. Separately, with the multi-field change a FULLTEXT column now also carries a <col>.keyword sub-field, so the same column serves full-text match (analyzed field) and exact =/IN/prefix (keyword sub-field). -- 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]
