From dc7e5d933e9b4c4de5e648261ccb0cd25fce456e Mon Sep 17 00:00:00 2001 From: Ronald Quenta Date: Tue, 29 Aug 2017 11:58:03 -0400 Subject: [PATCH] HOR-3806 --- workflow/engine/bin/reindex_solr.php | 5 ++- .../classes/BpmnEngineServicesSearchIndex.php | 31 ++++++------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php index 6844c0022..13342fd4a 100644 --- a/workflow/engine/bin/reindex_solr.php +++ b/workflow/engine/bin/reindex_solr.php @@ -22,6 +22,10 @@ * */ +require_once __DIR__ . '/../../../gulliver/system/class.g.php'; +require_once __DIR__ . '/../../../bootstrap/autoload.php'; +require_once __DIR__ . '/../../../bootstrap/app.php'; + // check script parameters // php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000] // var_dump($argv); @@ -117,7 +121,6 @@ if (! defined ('PATH_HOME')) { define( 'PATH_CLASSES', PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP ); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); - spl_autoload_register(array('Bootstrap', 'autoloadClass')); } print "PATH_HOME: " . PATH_HOME . "\n"; diff --git a/workflow/engine/classes/BpmnEngineServicesSearchIndex.php b/workflow/engine/classes/BpmnEngineServicesSearchIndex.php index 5d6687f33..8436a14c7 100644 --- a/workflow/engine/classes/BpmnEngineServicesSearchIndex.php +++ b/workflow/engine/classes/BpmnEngineServicesSearchIndex.php @@ -24,8 +24,7 @@ class BpmnEngineServicesSearchIndex */ public function isEnabled($workspace) { - require_once('class.solr.php'); - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); return $solr->isEnabled($workspace); } @@ -40,12 +39,6 @@ class BpmnEngineServicesSearchIndex */ public function getFacetsList($facetRequestEntity) { - require_once('class.solr.php'); - require_once('entities/FacetGroup.php'); - require_once('entities/FacetItem.php'); - require_once('entities/SelectedFacetGroupItem.php'); - require_once('entities/FacetResult.php'); - // get array of selected facet groups $facetRequestEntity->selectedFacetsString = str_replace(',,', ',', $facetRequestEntity->selectedFacetsString); // remove descriptions of selected facet groups @@ -98,7 +91,7 @@ class BpmnEngineServicesSearchIndex } $facetRequestEntity->filters = $filters; - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // create list of facets $facetsList = $solr->getFacetsList($facetRequestEntity); @@ -206,7 +199,7 @@ class BpmnEngineServicesSearchIndex public function getNumberDocuments($workspace) { require_once('class.solr.php'); - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // create list of facets $numberDocuments = $solr->getNumberDocuments($workspace); @@ -220,7 +213,7 @@ class BpmnEngineServicesSearchIndex */ public function updateIndexDocument($solrUpdateDocumentEntity) { - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // create list of facets $solr->updateDocument($solrUpdateDocumentEntity); @@ -233,7 +226,7 @@ class BpmnEngineServicesSearchIndex */ public function deleteDocumentFromIndex($workspace, $idQuery) { - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // create list of facets $solr->deleteDocument($workspace, $idQuery); @@ -245,7 +238,7 @@ class BpmnEngineServicesSearchIndex */ public function commitIndexChanges($workspace) { - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // commit $solr->commitChanges($workspace); @@ -257,7 +250,7 @@ class BpmnEngineServicesSearchIndex */ public function optimizeIndexChanges($workspace) { - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); // commit $solr->optimizeChanges($workspace); @@ -270,12 +263,8 @@ class BpmnEngineServicesSearchIndex */ public function getDataTablePaginatedList($solrRequestData) { - require_once('class.solr.php'); - require_once('entities/SolrRequestData.php'); - require_once('entities/SolrQueryResult.php'); - // execute query - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); $solrPaginatedResult = $solr->executeQuery($solrRequestData); // get total number of documents in index @@ -322,9 +311,7 @@ class BpmnEngineServicesSearchIndex */ public function getIndexFields($workspace) { - require_once('class.solr.php'); - - $solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost); + $solr = new BpmnEngineSearchIndexAccessSolr($this->_solrIsEnabled, $this->_solrHost); $solrFieldsData = $solr->getListIndexedStoredFields($workspace); // copy list of arrays