Skip to content

Commit

Permalink
Update flush to delete index and load mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed May 23, 2024
1 parent e13268c commit cd07c85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/arSolrPlugin/lib/arSolrPlugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}

Expand All @@ -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();
Expand Down

0 comments on commit cd07c85

Please sign in to comment.