From cd07c85a4f81145a9e26e2b225d07d325e987091 Mon Sep 17 00:00:00 2001 From: mlnkng Date: Wed, 22 May 2024 00:31:00 -0700 Subject: [PATCH] Update flush to delete index and load mapping. --- plugins/arSolrPlugin/lib/arSolrPlugin.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/arSolrPlugin/lib/arSolrPlugin.class.php b/plugins/arSolrPlugin/lib/arSolrPlugin.class.php index dd05646803..ad79d4256d 100644 --- a/plugins/arSolrPlugin/lib/arSolrPlugin.class.php +++ b/plugins/arSolrPlugin/lib/arSolrPlugin.class.php @@ -132,8 +132,9 @@ public function loadDiacriticsMappings() public function flush() { try { - $url = $this->solrBaseUrl.'/solr/admin/collections?action=DELETE&name='.$this->solrClientOptions['collection']; - arSolrPlugin::makeHttpRequest($url); + $url = $this->solrBaseUrl.'/solr/'.$this->solrClientOptions['collection'].'/update/'; + $query = '{"delete": {"query": "*:*"}}'; + arSolrPlugin::makeHttpRequest($url, 'POST', $query); } catch (Exception $e) { } @@ -155,6 +156,9 @@ public function populate($options = []) if (!count($excludeTypes) && !$update) { $this->flush(); $this->log('Index erased.'); + + // Load mappings + $this->loadAndNormalizeMappings(); } else { // Initialize index if necessary $this->initialize();