void InvertedIndexConfig::Check()

in aios/storage/indexlib/index/inverted_index/config/InvertedIndexConfig.cpp [196:249]


void InvertedIndexConfig::Check() const
{
    if (_impl->isIndexUpdatable) {
        bool isIndexUpdatable =
            (_impl->invertedIndexType == it_number) || (_impl->invertedIndexType == it_number_int8) ||
            (_impl->invertedIndexType == it_number_int16) || (_impl->invertedIndexType == it_number_int32) ||
            (_impl->invertedIndexType == it_number_int64) || (_impl->invertedIndexType == it_number_uint8) ||
            (_impl->invertedIndexType == it_number_uint16) || (_impl->invertedIndexType == it_number_uint32) ||
            (_impl->invertedIndexType == it_number_uint64) || (_impl->invertedIndexType == it_string);
        isIndexUpdatable = isIndexUpdatable && (_impl->optionFlag == 0);
        if (!isIndexUpdatable) {
            INDEXLIB_FATAL_ERROR(Schema, "index [%s] does not support [%s = true].", _impl->indexName.c_str(),
                                 INDEX_UPDATABLE.c_str());
        }
    }
    if ((_impl->optionFlag & of_position_payload) && !(_impl->optionFlag & of_position_list)) {
        INDEXLIB_FATAL_ERROR(Schema, "position payload flag is 1 but no position list. index name [%s]",
                             GetIndexName().c_str());
    }

    if (!_impl->dictConfig && !_impl->adaptiveDictConfig &&
        _impl->highFrequencyTermPostingType == indexlib::index::hp_both) {
        INDEXLIB_FATAL_ERROR(Schema,
                             "index[%s] error: high_frequency_term_posting_type is set to both"
                             " without high_frequency_dictionary[%d]/high_frequency_adaptive_dictionary[%d]",
                             _impl->indexName.c_str(), _impl->dictConfig ? 1 : 0, _impl->adaptiveDictConfig ? 1 : 0);
    }

    if (_impl->isReferenceCompress &&
        ((_impl->optionFlag & of_term_frequency) && !(_impl->optionFlag & of_tf_bitmap))) {
        INDEXLIB_FATAL_ERROR(Schema, "reference_compress does not support tf(not tf_bitmap), index name [%s]",
                             GetIndexName().c_str());
    }

    if (_impl->formatVersionId > _impl->maxSupportedFormatVersionId) {
        INDEXLIB_FATAL_ERROR(Schema, "format_verison_id [%d] over max supported value [%d], index name [%s]",
                             _impl->formatVersionId, _impl->maxSupportedFormatVersionId, GetIndexName().c_str());
    }

    bool supportFileCompress =
        (_impl->invertedIndexType == it_number) || (_impl->invertedIndexType == it_number_int8) ||
        (_impl->invertedIndexType == it_number_int16) || (_impl->invertedIndexType == it_number_int32) ||
        (_impl->invertedIndexType == it_number_int64) || (_impl->invertedIndexType == it_number_uint8) ||
        (_impl->invertedIndexType == it_number_uint16) || (_impl->invertedIndexType == it_number_uint32) ||
        (_impl->invertedIndexType == it_number_uint64) || (_impl->invertedIndexType == it_string) ||
        (_impl->invertedIndexType == it_text) || (_impl->invertedIndexType == it_pack) ||
        (_impl->invertedIndexType == it_expack) || (_impl->invertedIndexType == it_range) ||
        (_impl->invertedIndexType == it_date) || (_impl->invertedIndexType == it_spatial);
    if (_impl->fileCompressConfig && !_impl->fileCompressConfig->GetCompressType().empty() && !supportFileCompress) {
        INDEXLIB_FATAL_ERROR(Schema, "index [%s] with type [%s] not support enable file_compress",
                             _impl->indexName.c_str(),
                             InvertedIndexConfig::InvertedIndexTypeToStr(_impl->invertedIndexType));
    }
}