static KiePMMLTextIndex getKiePMMLTextIndex(final TextIndex textIndex) {
        final LOCAL_TERM_WEIGHTS localTermWeights = textIndex.getLocalTermWeights() != null ?
                LOCAL_TERM_WEIGHTS.byName(textIndex.getLocalTermWeights().value()) : null;
        final COUNT_HITS countHits = textIndex.getCountHits() != null ?
                COUNT_HITS.byName(textIndex.getCountHits().value()) : null;
        final String wordSeparatorCharacterRE = textIndex.getWordSeparatorCharacterRE() != null ?
                StringEscapeUtils.escapeJava(textIndex.getWordSeparatorCharacterRE()) : null;
        return KiePMMLTextIndex.builder(textIndex.getTextField(),
                                        getKiePMMLExtensions(textIndex.getExtensions()),
                                        getKiePMMLExpression(textIndex.getExpression()))
                .withTextIndexNormalizations(getKiePMMLTextIndexNormalizations(textIndex.getTextIndexNormalizations()))
                .withLocalTermWeights(localTermWeights)
                .withIsCaseSensitive(textIndex.isCaseSensitive())
                .withMaxLevenshteinDistance(textIndex.getMaxLevenshteinDistance())
                .withCountHits(countHits)
                .withWordSeparatorCharacterRE(wordSeparatorCharacterRE)
                .withTokenize(textIndex.isTokenize())
                .build();
    }
@Test
    void getKiePMMLTextIndex() {
        final TextIndex toConvert = getRandomTextIndex();
        final KiePMMLTextIndex retrieved = KiePMMLTextIndexInstanceFactory.getKiePMMLTextIndex(toConvert);
        commonVerifyKiePMMLTextIndex(retrieved, toConvert);
    }