Source:
private void createTextIndexForColumn(ColumnMetadata columnMetadata) throws Exception { String column = columnMetadata.getColumnName(); if (_segmentWriter.hasIndexFor(column, ColumnIndexType.TEXT_INDEX)) { LOGGER.info("Found text index for column: {}, in segment: {}", column, _segmentName); return; } int numDocs = columnMetadata.getTotalDocs(); boolean hasDictionary = columnMetadata.hasDictionary(); LOGGER.info("Creating new text index for column: in segment: {}, hasDictionary: {}", column, _segmentName, hasDictionary); File segmentDirectory = SegmentDirectoryPaths.segmentDirectoryFor(_indexDir, _segmentVersion); try (ForwardIndexReader forwardIndexReader = getForwardIndexReader(columnMetadata); ForwardIndexReaderContext readerContext = forwardIndexReader.createContext(); LuceneTextIndexCreator textIndexCreator = new LuceneTextIndexCreator(column, segmentDirectory, true)) { if (!hasDictionary) { VarByteChunkSVForwardIndexReader rawIndexReader = (VarByteChunkSVForwardIndexReader)forwardIndexReader; ChunkReaderContext chunkReaderContext = (ChunkReaderContext)readerContext; for (int docId = 0; docId < numDocs; docId++) { textIndexCreator.addDoc(rawIndexReader.getString(docId, chunkReaderContext), docId); } } else { try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata)) { if (columnMetadata.isSingleValue()) { for (int docId = 0; docId < numDocs; docId++) { int dictId = forwardIndexReader.getDictId(docId, readerContext); String value = dictionary.getStringValue(dictId); textIndexCreator.addDoc(value, docId); } } } } textIndexCreator.seal(); } LOGGER.info("Created text index for column: in segment: {}", column, _segmentName); PropertiesConfiguration properties = SegmentMetadataImpl.getPropertiesConfiguration(_indexDir); properties.setProperty(getKeyFor(column, TEXT_INDEX_TYPE), TextIndexType.LUCENE.name()); properties.save(); }

Target:
private void createTextIndexForColumn(ColumnMetadata columnMetadata) throws Exception { String column = columnMetadata.getColumnName(); if (_segmentWriter.hasIndexFor(column, ColumnIndexType.TEXT_INDEX)) { LOGGER.info("Found text index for column: {}, in segment: {}", column, _segmentName); return; } int numDocs = columnMetadata.getTotalDocs(); boolean hasDictionary = columnMetadata.hasDictionary(); LOGGER.info("Creating new text index for column: in segment: {}, hasDictionary: {}", column, _segmentName, hasDictionary); File segmentDirectory = SegmentDirectoryPaths.segmentDirectoryFor(_indexDir, _segmentVersion); try (ForwardIndexReader forwardIndexReader = getForwardIndexReader(columnMetadata); ForwardIndexReaderContext readerContext = forwardIndexReader.createContext(); LuceneTextIndexCreator textIndexCreator = new LuceneTextIndexCreator(column, segmentDirectory, true)) { if (!hasDictionary) { VarByteChunkSVForwardIndexReader rawIndexReader = (VarByteChunkSVForwardIndexReader)forwardIndexReader; ChunkReaderContext chunkReaderContext = (ChunkReaderContext)readerContext; for (int docId = 0; docId < numDocs; docId++) { textIndexCreator.addDoc(rawIndexReader.getString(docId, chunkReaderContext), docId); } } else { try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata)) { for (int docId = 0; docId < numDocs; docId++) { int dictId = forwardIndexReader.getDictId(docId, readerContext); String value = dictionary.getStringValue(dictId); textIndexCreator.addDoc(value, docId); } } } textIndexCreator.seal(); } LOGGER.info("Created text index for column: in segment: {}", column, _segmentName); PropertiesConfiguration properties = SegmentMetadataImpl.getPropertiesConfiguration(_indexDir); properties.setProperty(getKeyFor(column, TEXT_INDEX_TYPE), TextIndexType.LUCENE.name()); properties.save(); }