Layered Navigation Filter Problem. Working in Magento 2.3.2 but not in Magento 2.4.1

I created this module about a year ago. Maybe because of elasticseach search engine or something now I am facing this error in Magento 2.4.1

main.CRITICAL: Error: Call to undefined method
MagentoCatalogSearchModelResourceModelFulltextCollectionInterceptor::getCollectionClone()
in
D:xampphtdocsms241appcode[Vendor]LayeredNavigationModelLayerFilterAttribute.php:115

The full function in the Attribute.php file is like this

protected function _getItemsData()
    {
        if (!$this->_moduleHelper->isLayeredNavigationEnabled()) {
            return parent::_getItemsData();
        }

        $attribute = $this->getAttributeModel();

        /** @var [Vendor]LayeredNavigationModelResourceModelFulltextCollection $productCollection */
        $productCollection = $this->getLayer()->getProductCollection();

        if ($this->_isFilter) {
            $productCollection = $productCollection->getCollectionClone()
                ->removeAttributeSearch($attribute->getAttributeCode());// ERROR HERE
        }

        $optionsFacetedData = $productCollection->getFacetedData($attribute->getAttributeCode());

        if (count($optionsFacetedData) === 0
            && $this->getAttributeIsFilterable($attribute) !== static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
        ) {
            return $this->itemDataBuilder->build();
        }

        $productSize = $productCollection->getSize();

        $itemData   = [];
        $checkCount = false;

        $options = $attribute->getFrontend()
            ->getSelectOptions();
        foreach ($options as $option) {
            if (empty($option['value'])) {
                continue;
            }

            $value = $option['value'];

            $count = isset($optionsFacetedData[$value]['count'])
                ? (int)$optionsFacetedData[$value]['count']
                : 0;

            // Check filter type
            if ($this->getAttributeIsFilterable($attribute) == static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
                && (!$this->_moduleHelper->getFilterModel()->isOptionReducesResults($this, $count, $productSize))
            ) {
                continue;
            }

            if ($count > 0) {
                $checkCount = true;
            }

            $itemData[] = [
                'label' => $this->tagFilter->filter($option['label']),
                'value' => $value,
                'count' => $count
            ];
        }

        if ($checkCount) {
            foreach ($itemData as $item) {
                $this->itemDataBuilder->addItemData($item['label'], $item['value'], $item['count']);
            }
        }

        return $this->itemDataBuilder->build();

Module’s di.xml file is like this

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="categoryFilterList" type="MagentoCatalogModelLayerFilterList">
        <arguments>
            <argument name="filters" xsi:type="array">
                <item name="attribute" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterAttribute</item>
                <item name="price" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterPrice</item>
                <item name="category" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterCategory</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="searchFilterList" type="MagentoCatalogModelLayerFilterList">
        <arguments>
            <argument name="filters" xsi:type="array">
                <item name="attribute" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterAttribute</item>
                <item name="price" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterPrice</item>
                <item name="category" xsi:type="string">[Vendor]LayeredNavigationModelLayerFilterCategory</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="MagentoCatalogSearchModelResourceModelFulltextCollectionFactory" type="MagentoCatalogModelResourceModelProductCollectionFactory">
        <arguments>
            <argument name="instanceName" xsi:type="string">[Vendor]LayeredNavigationModelResourceModelFulltextCollection</argument>
        </arguments>
    </virtualType>
    <virtualType name="MagentoCatalogSearchModelResourceModelFulltextSearchCollection" type="[Vendor]LayeredNavigationModelResourceModelFulltextCollection">
        <arguments>
            <argument name="searchRequestName" xsi:type="string">quick_search_container</argument>
        </arguments>
    </virtualType>
</config>

If I do this change navigation filter won’t show

if ($this->_isFilter) {
    //$productCollection = $productCollection->getCollectionClone()
    //    ->removeAttributeSearch($attribute->getAttributeCode());
        $productCollectionClone = clone $productCollection;
        $productCollectionClone->removeAttributeSearch($attribute->getAttributeCode());
}

$optionsFacetedData = $productCollectionClone->getFacetedData($attribute->getAttributeCode()); // ERROR HERE

main.CRITICAL: Notice: Undefined variable: productCollectionClone in
D:xampphtdocsms241appcode[Vendor]LayeredNavigationModelLayerFilterAttribute.php
on line 121

And If I do this change navigation filter is showing but not working

if ($this->_isFilter) {
            //$productCollection = $productCollection->getCollectionClone()
            //    ->removeAttributeSearch($attribute->getAttributeCode());
                $productCollection = clone $productCollection;
                $productCollection->removeAttributeSearch($attribute->getAttributeCode());
        }

main.CRITICAL: Error: Call to undefined method
MagentoCatalogSearchModelResourceModelFulltextCollectionInterceptor::removeAttributeSearch()
in
D:xampphtdocsms241appcode[Vendor]LayeredNavigationModelLayerFilterAttribute.php:118

[Vendor]LayeredNavigationModelResourceModelFulltextCollection.php has getCollectionClone() & removeAttributeSearch() functions like this

public function getCollectionClone()
    {
        if ($this->collectionClone === null) {
            $this->collectionClone = clone $this;
            $this->collectionClone->setSearchCriteriaBuilder($this->searchCriteriaBuilder->cloneObject());
        }

        $searchCriterialBuilder = $this->collectionClone->getSearchCriteriaBuilder()->cloneObject();

        /** @var [Vendor]LayeredNavigationModelResourceModelFulltextCollection $collectionClone */
        $collectionClone = clone $this->collectionClone;
        $collectionClone->setSearchCriteriaBuilder($searchCriterialBuilder);

        return $collectionClone;
    }

public function removeAttributeSearch($attributeCode)
    {
        if (is_array($attributeCode)) {
            foreach ($attributeCode as $attCode) {
                $this->searchCriteriaBuilder->removeFilter($attCode);
            }
        } else {
            $this->searchCriteriaBuilder->removeFilter($attributeCode);
        }

        $this->_isFiltersRendered = false;

        return $this->loadWithFilter();
    }

After adding this to di.xml

<virtualType name="elasticsearchLayerCategoryItemCollectionProvider" type="MagentoElasticsearchModelLayerCategoryItemCollectionProvider">
        <arguments>
            <argument name="factories" xsi:type="array">
                <item name="elasticsearch7" xsi:type="object">[Vendor]LayeredNavigationModelResourceModelFulltextCollectionFactory</item><!-- Alioze AdrienF -->
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="elasticsearchLayerSearchItemCollectionProvider" type="MagentoElasticsearchModelLayerSearchItemCollectionProvider">
        <arguments>
            <argument name="factories" xsi:type="array">
                <item name="elasticsearch7" xsi:type="object">[Vendor]LayeredNavigationModelResourceModelFulltextCollectionFactory</item><!-- Alioze AdrienF -->
            </argument>
        </arguments>
    </virtualType>

And changing this MagentoElasticsearchSearchAdapterQueryBuilderSort.php

private const DEFAULT_SKIPPED_FIELDS = [
        'entity_id',
    ];

To

private const DEFAULT_SKIPPED_FIELDS = [
        null,
         'entity_id',
    ];

I am able to filter products with single filter value like one color or one size but multiple selection not working giving me this errors

{“0″:”Sorry, something went wrong. You can find out more in the error
log.”,”1″:”
#1 MagentoFrameworkDataCollectionAbstractDb->_renderFilters() called at
[appcode[Vendor]LayeredNavigationModelResourceModelFulltextCollection.php:391]n
#2 [Vendor]LayeredNavigationModelResourceModelFulltextCollection->_renderFilters()
called at
[vendormagentoframeworkDataCollectionAbstractDb.php:578]n
#3 MagentoFrameworkDataCollectionAbstractDb->loadWithFilter(false,
false) called at
[generatedcode[Vendor]LayeredNavigationModelResourceModelFulltextCollectionInterceptor.php:1076]n
#4 [Vendor]LayeredNavigationModelResourceModelFulltextCollectionInterceptor->loadWithFilter()
called at
[appcode[Vendor]LayeredNavigationModelResourceModelFulltextCollection.php:179]n
#5 [Vendor]LayeredNavigationModelResourceModelFulltextCollection->removeAttributeSearch(‘color’)
called at
[generatedcode[Vendor]LayeredNavigationModelResourceModelFulltextCollectionInterceptor.php:41]n
#6 [Vendor]LayeredNavigationModelResourceModelFulltextCollectionInterceptor->removeAttributeSearch(‘color’)
called at
[appcode[Vendor]LayeredNavigationModelLayerFilterAttribute.php:116]n
#7 [Vendor]LayeredNavigationModelLayerFilterAttribute->_getItemsData()
called at
[vendormagentomodule-catalogModelLayerFilterAbstractFilter.php:202]n
#8 MagentoCatalogModelLayerFilterAbstractFilter->_initItems()
called at
[vendormagentomodule-catalogModelLayerFilterAbstractFilter.php:159]n
#9 MagentoCatalogModelLayerFilterAbstractFilter->getItems() called at
[vendormagentomodule-catalogModelLayerFilterAbstractFilter.php:148]n#10

Basically, the module was for multiple selections of navigation filters. Like we can choose filter color red and black or any other color also. The same goes for other filters.

I have checked this module is working in Magento 2.3.2 with PHP version 7.1.7 where Configuration->Catalog->Catalog Search->Search engine is = MYSQL

There are many files so let me know if anything else needs to be shared here. Any help would be great.