HOR-3670-RG observations
This commit is contained in:
@@ -2,49 +2,28 @@
|
||||
|
||||
/**
|
||||
* Class used as interface to have access to the search index services
|
||||
*
|
||||
* @author Herbert Saal Gutierrez
|
||||
*
|
||||
*/
|
||||
class BpmnEngineServicesSearchIndex
|
||||
{
|
||||
|
||||
private $_solrIsEnabled = false;
|
||||
private $_solrHost = "";
|
||||
|
||||
public function __construct($solrIsEnabled = false, $solrHost = "")
|
||||
{
|
||||
// check if Zend Library is available
|
||||
// if(class_exists("Zend_Registry")){
|
||||
// $registry = Zend_Registry::getInstance();
|
||||
// //check if configuration is enabled
|
||||
// $this->solrIsEnabled = $registry->isRegistered('solrEnabled') &&
|
||||
// $registry->get('solrEnabled') == 1;
|
||||
// $this->solrHost =
|
||||
// $registry->isRegistered('solrHost')?$registry->get('solrHost'):"";
|
||||
// }
|
||||
// else{
|
||||
// //use the parameters to initialize class
|
||||
$this->_solrIsEnabled = $solrIsEnabled;
|
||||
$this->_solrHost = $solrHost;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the Solr service is available
|
||||
*
|
||||
* @gearman = false
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* no input parameters @param[in]
|
||||
*
|
||||
* @param
|
||||
* [out] bool true if index service is enabled false in other case
|
||||
* @background = false no input parameters @param[in]
|
||||
* @param [out] bool true if index service is enabled false in other case
|
||||
*/
|
||||
public function isEnabled($workspace)
|
||||
{
|
||||
// require_once (ROOT_PATH .
|
||||
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
|
||||
require_once('class.solr.php');
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
return $solr->isEnabled($workspace);
|
||||
@@ -52,28 +31,21 @@ class BpmnEngineServicesSearchIndex
|
||||
|
||||
/**
|
||||
* Get the list of facets in base to the specified query and filter
|
||||
*
|
||||
* @gearman = true
|
||||
* @rest = false
|
||||
* @background = false
|
||||
*
|
||||
* @param
|
||||
* [in] Entity_FacetRequest facetRequestEntity Facet request entity
|
||||
* @param
|
||||
* [out] array FacetGroup
|
||||
* @param [in] Entity_FacetRequest facetRequestEntity Facet request entity
|
||||
* @param [out] array FacetGroup
|
||||
*/
|
||||
public function getFacetsList($facetRequestEntity)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
// require_once (ROOT_PATH .
|
||||
// '/businessLogic/modules/SearchIndexAccess/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
|
||||
@@ -105,9 +77,6 @@ class BpmnEngineServicesSearchIndex
|
||||
$aSelectedFacetGroups [] = Entity_SelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
|
||||
}
|
||||
|
||||
/**
|
||||
* ***************************************************************
|
||||
*/
|
||||
// convert request to index request
|
||||
// create filters
|
||||
$filters = array();
|
||||
@@ -123,10 +92,6 @@ class BpmnEngineServicesSearchIndex
|
||||
));
|
||||
}
|
||||
|
||||
// $facetFields = array_diff($facetFields,
|
||||
// $facetInterfaceRequestEntity->selectedFacetGroups);
|
||||
// $facetDates = array_diff($facetDates,
|
||||
// $facetInterfaceRequestEntity->selectedFacetGroups);
|
||||
foreach ($aSelectedFacetGroups as $group) {
|
||||
$filters [] = $group->selectedFacetGroupName . ':' . urlencode($group->selectedFacetItemName);
|
||||
}
|
||||
@@ -143,10 +108,8 @@ class BpmnEngineServicesSearchIndex
|
||||
$facetCounts = $facetsList->facet_counts;
|
||||
|
||||
$facetGroups = array();
|
||||
|
||||
// convert facet fields result to objects
|
||||
/**
|
||||
* *********************************************************************
|
||||
*/
|
||||
// include facet field results
|
||||
$facetFieldsResult = $facetsList->facet_counts->facet_fields;
|
||||
if (!empty($facetFieldsResult)) {
|
||||
@@ -174,9 +137,7 @@ class BpmnEngineServicesSearchIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* *********************************************************************
|
||||
*/
|
||||
|
||||
// include facet date ranges results
|
||||
$facetDatesResult = $facetsList->facet_counts->facet_dates;
|
||||
if (!empty($facetDatesResult)) {
|
||||
@@ -217,10 +178,6 @@ class BpmnEngineServicesSearchIndex
|
||||
}
|
||||
}
|
||||
// TODO:convert facet queries
|
||||
// -----
|
||||
/**
|
||||
* ***************************************************************
|
||||
*/
|
||||
// Create a filter string used in the filter of results of a datatable
|
||||
$filterText = ''; // the list of selected filters used for filtering result,
|
||||
// send in ajax
|
||||
@@ -228,11 +185,7 @@ class BpmnEngineServicesSearchIndex
|
||||
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode($selectedFacetGroup->selectedFacetItemName) . ',';
|
||||
}
|
||||
$filterText = substr_replace($filterText, '', - 1);
|
||||
// $filterText = ($filterText == '')?'':'&filterText='.$filterText;
|
||||
|
||||
/**
|
||||
* ***************************************************************
|
||||
*/
|
||||
|
||||
// Create result
|
||||
$dataFacetResult = array(
|
||||
'aFacetGroups' => $facetGroups,
|
||||
@@ -253,8 +206,6 @@ class BpmnEngineServicesSearchIndex
|
||||
public function getNumberDocuments($workspace)
|
||||
{
|
||||
require_once('class.solr.php');
|
||||
// require_once (ROOT_PATH .
|
||||
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// create list of facets
|
||||
@@ -323,23 +274,6 @@ class BpmnEngineServicesSearchIndex
|
||||
require_once('entities/SolrRequestData.php');
|
||||
require_once('entities/SolrQueryResult.php');
|
||||
|
||||
// prepare the list of sorted columns
|
||||
// verify if the data of sorting is available
|
||||
//if (isset ($solrRequestData->sortCols [0])) {
|
||||
// for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) {
|
||||
// verify if column is sortable
|
||||
//if ($solrRequestData->includeCols [$solrRequestData->sortCols [$i]] != '' && $solrRequestData->sortableCols [$i] == "true") {
|
||||
// change sorting column index to column names
|
||||
//$solrRequestData->sortCols [$i] = $solrRequestData->includeCols [$solrRequestData->sortCols [$i]];
|
||||
// define the direction of the sorting columns
|
||||
//$solrRequestData->sortDir [$i] = $solrRequestData->sortDir [$i];
|
||||
//}
|
||||
// }
|
||||
//}
|
||||
// remove placeholder fields
|
||||
// the placeholder doesn't affect the the solr's response
|
||||
// $solrRequestData->includeCols = array_diff($solrRequestData->includeCols,
|
||||
// array(''));
|
||||
// execute query
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
$solrPaginatedResult = $solr->executeQuery($solrRequestData);
|
||||
@@ -351,13 +285,12 @@ class BpmnEngineServicesSearchIndex
|
||||
$numFound = $solrPaginatedResult->response->numFound;
|
||||
|
||||
$docs = $solrPaginatedResult->response->docs;
|
||||
// print_r($docs);
|
||||
|
||||
// insert list of names in docs result
|
||||
$data = array(
|
||||
"sEcho" => '', // must be completed in response
|
||||
"iTotalRecords" => intval($numTotalDocs), // we must get the
|
||||
// total number of
|
||||
// documents
|
||||
// total number of documents
|
||||
"iTotalDisplayRecords" => $numFound,
|
||||
"aaData" => array()
|
||||
);
|
||||
@@ -378,7 +311,6 @@ class BpmnEngineServicesSearchIndex
|
||||
}
|
||||
|
||||
$solrQueryResponse = Entity_SolrQueryResult::createForRequest($data);
|
||||
//
|
||||
|
||||
return $solrQueryResponse;
|
||||
}
|
||||
@@ -394,19 +326,16 @@ class BpmnEngineServicesSearchIndex
|
||||
|
||||
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
|
||||
|
||||
// print "SearchIndex!!!!";
|
||||
// create list of facets
|
||||
$solrFieldsData = $solr->getListIndexedStoredFields($workspace);
|
||||
// copy list of arrays
|
||||
$listFields = array();
|
||||
foreach ($solrFieldsData->fields as $key => $fieldData) {
|
||||
if (array_key_exists('dynamicBase', $fieldData)) {
|
||||
$originalFieldName = substr($key, 0, - strlen($fieldData->dynamicBase) + 1);
|
||||
// $listFields[strtolower($originalFieldName)] = $key; //in case of case insentive strings
|
||||
|
||||
// Maintain case sensitive variable names
|
||||
$listFields [$originalFieldName] = $key;
|
||||
} else {
|
||||
// $listFields[strtolower($key)] = $key;
|
||||
// Maintain case sensitive variable names
|
||||
$listFields [$key] = $key;
|
||||
}
|
||||
@@ -414,5 +343,4 @@ class BpmnEngineServicesSearchIndex
|
||||
|
||||
return $listFields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* This class is derived from the class archive, is employed to use files .bzip
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
*/class BzipFile extends tar_file
|
||||
*/
|
||||
class BzipFile extends tar_file
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -59,5 +56,4 @@
|
||||
{
|
||||
return @bzopen($this->options['name'], "rb");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user