chenboat commented on code in PR #16364: URL: https://github.com/apache/pinot/pull/16364#discussion_r2289441991
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/invertedindex/RealtimeNgramFilteringIndex.java: ########## @@ -0,0 +1,188 @@ +/** + * 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.pinot.segment.local.realtime.impl.invertedindex; + +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import java.io.IOException; +import java.util.ArrayList; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.apache.lucene.analysis.ngram.NGramTokenizer; +import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.pinot.segment.spi.index.mutable.MutableTextIndex; +import org.roaringbitmap.buffer.ImmutableRoaringBitmap; +import org.roaringbitmap.buffer.MutableRoaringBitmap; + + +/** + * RealtimeNgramFilteringIndex is a mutable inverted index that supports adding document IDs for n-grams. An n-gram + * is a contiguous sequence of n characters from input text. The length of the n-gram is variable between + * [minNgramLength, maxNgramLength] as specified in the index config. Internally, it uses a realtime inverted index + * which maps n-grams to their posting lists (document IDs). The index is thread-safe for single writer and multiple + * readers. + */ +public class RealtimeNgramFilteringIndex implements MutableTextIndex { Review Comment: ngram index is primarily designed for index text data -- so as a sub-class of textindex interface is fine. The interface on add(String doc) is also appropriate for ngram index. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org