From 969e0a73e7fd64026efdf31388a818ff53324974 Mon Sep 17 00:00:00 2001 From: alina712 Date: Sun, 17 Nov 2024 16:00:56 +0200 Subject: [PATCH] Fixed v0/cleanjobs Jobs for companies with multi-word names can now be deleted by properly handling the space character in the query. Closes --420 --- v0/cleanjobs/index.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/v0/cleanjobs/index.php b/v0/cleanjobs/index.php index 1505ee0..268d984 100644 --- a/v0/cleanjobs/index.php +++ b/v0/cleanjobs/index.php @@ -12,15 +12,7 @@ // Step 1: Get the count of jobs for the given company $countCommand = '/select'; - - $countQS = '?'; - $countQS .= 'q=hiringOrganization.name:"'; - $countQS .= rawurlencode($company); - $countQS .= '"&'; - $countQS .= 'wt=json'; - $countQS .= '&'; - $countQS .= 'rows=0'; - + $countQS = '?q=' . rawurlencode('hiringOrganization.name:"' . $company . '"') . '&wt=json&rows=0'; $countUrl = 'http://' . $server . '/solr/' . $core . $countCommand . $countQS; try { @@ -47,19 +39,10 @@ // Step 2: Delete the jobs $deleteCommand = '/update'; - - $qs = '?'; - $qs .= '_=1617366504771'; - $qs .= '&'; - $qs .= 'commitWithin=1000'; - $qs .= '&'; - $qs .= 'overwrite=true'; - $qs .= '&'; - $qs .= 'wt=json'; - + $qs = '?commit=true&wt=json'; $deleteUrl = 'http://' . $server . '/solr/' . $core . $deleteCommand . $qs; - $deleteData = json_encode(['delete' => ['query' => 'hiringOrganization.name:"' . rawurlencode($company) . '"']]); + $deleteData = json_encode(['delete' => ['query' => 'hiringOrganization.name:"' . $company . '"']]); $options = array( 'http' => array(