SOLR IMPLEMENTATION FOR v4.0 UPDATES (First Part)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2012 Colosa Inc.23
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* For more information, contact Colosa Inc, 5304 Ventura Drive,
|
||||
* Delray Beach, FL, 33484, USA, or email info@colosa.com.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// check script parameters
|
||||
@@ -28,18 +28,18 @@
|
||||
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
|
||||
$commandLineSyntaxMsg = "Invalid command line arguments: \n " .
|
||||
"syntax: ".
|
||||
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
|
||||
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
|
||||
" Where \n".
|
||||
" reindexall : reindex all the database. \n" .
|
||||
" reindexall : reindex all the database. \n" .
|
||||
" reindexmissing: reindex only the missing records stored in database. \n".
|
||||
" (records defined in APP_SOLR_QUEUE table are required)\n" .
|
||||
" optimizeindex: optimize the changes in the search index. (used to get faster results) \n" .
|
||||
" Optional Options: \n" .
|
||||
" -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" .
|
||||
" -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
|
||||
" -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
|
||||
|
||||
if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
|
||||
($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) {
|
||||
if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
|
||||
($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) {
|
||||
print $commandLineSyntaxMsg;
|
||||
die ();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ if(count ($argv) > 3) {
|
||||
if($argv [$argNumber] == '-appuid') {
|
||||
//use skip option
|
||||
$appUid = $argv [$argNumber + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print $commandLineSyntaxMsg;
|
||||
@@ -73,11 +73,19 @@ if(count ($argv) > 3) {
|
||||
}
|
||||
}
|
||||
|
||||
$debug = 1;
|
||||
|
||||
ini_set ('display_errors', 1);
|
||||
error_reporting (E_ALL);
|
||||
//error_reporting (E_ALL);
|
||||
ini_set ('memory_limit', '256M'); // set enough memory for the script
|
||||
|
||||
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
|
||||
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
|
||||
$e_all = $debug ? $e_all : $e_all & ~ E_NOTICE;
|
||||
|
||||
ini_set( 'error_reporting', $e_all );
|
||||
|
||||
|
||||
if (! defined ('SYS_LANG')) {
|
||||
define ('SYS_LANG', 'en');
|
||||
}
|
||||
@@ -98,13 +106,16 @@ if (! defined ('PATH_HOME')) {
|
||||
array_pop ($docuroot);
|
||||
$pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
|
||||
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
|
||||
|
||||
|
||||
define ('PATH_HOME', $pathhome);
|
||||
define ('PATH_TRUNK', $pathTrunk);
|
||||
define ('PATH_OUTTRUNK', $pathOutTrunk);
|
||||
|
||||
|
||||
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
require_once (PATH_GULLIVER . "class.bootstrap.php");
|
||||
Bootstrap::registerSystemClasses();
|
||||
spl_autoload_register(array('Bootstrap', 'autoloadClass'));
|
||||
|
||||
G::LoadThirdParty ('pear/json', 'class.json');
|
||||
G::LoadThirdParty ('smarty/libs', 'Smarty.class');
|
||||
G::LoadSystem ('error');
|
||||
@@ -129,23 +140,10 @@ if (! defined ('PATH_HOME')) {
|
||||
require_once ("creole/Creole.php");
|
||||
}
|
||||
|
||||
if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) {
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php");
|
||||
}
|
||||
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php");
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
|
||||
|
||||
require_once (PATH_GULLIVER . "class.bootstrap.php");
|
||||
|
||||
spl_autoload_register(array("Bootstrap", "autoloadClass"));
|
||||
|
||||
Bootstrap::registerSystemClasses();
|
||||
|
||||
//require_once 'classes/model/AppDelegation.php';
|
||||
//require_once 'classes/model/Event.php';
|
||||
//require_once 'classes/model/AppEvent.php';
|
||||
//require_once 'classes/model/CaseScheduler.php';
|
||||
require_once 'classes/model/AppDelegation.php';
|
||||
require_once 'classes/model/Event.php';
|
||||
require_once 'classes/model/AppEvent.php';
|
||||
require_once 'classes/model/CaseScheduler.php';
|
||||
// G::loadClass('pmScript');
|
||||
|
||||
// //default values
|
||||
@@ -171,36 +169,36 @@ if (! defined ('SYS_SYS')) {
|
||||
$sObject = $workspaceName;
|
||||
$sNow = ''; // $argv[2];
|
||||
$sFilter = '';
|
||||
|
||||
|
||||
for ($i = 3; $i < count ($argv); $i++) {
|
||||
$sFilter .= ' ' . $argv [$i];
|
||||
}
|
||||
|
||||
|
||||
$oDirectory = dir (PATH_DB);
|
||||
|
||||
|
||||
if (is_dir (PATH_DB . $sObject)) {
|
||||
saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
|
||||
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
|
||||
|
||||
|
||||
define ('SYS_SYS', $sObject);
|
||||
|
||||
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
//require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
define ('MEMCACHED_ENABLED', $config ['memcached']);
|
||||
define ('MEMCACHED_SERVER', $config ['memcached_server']);
|
||||
define ('TIME_ZONE', $config ['time_zone']);
|
||||
|
||||
|
||||
date_default_timezone_set (TIME_ZONE);
|
||||
print "TIME_ZONE: " . TIME_ZONE . "\n";
|
||||
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
|
||||
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n";
|
||||
// ****************************************
|
||||
|
||||
//include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
|
||||
//include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
|
||||
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
|
||||
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
// ***************** PM Paths DATA **************************
|
||||
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
|
||||
@@ -210,7 +208,7 @@ if (! defined ('SYS_SYS')) {
|
||||
define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
|
||||
define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
|
||||
define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
|
||||
|
||||
|
||||
// server info file
|
||||
if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
|
||||
$SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info');
|
||||
@@ -222,10 +220,10 @@ if (! defined ('SYS_SYS')) {
|
||||
else {
|
||||
eprintln ("WARNING! No server info found!", 'red');
|
||||
}
|
||||
|
||||
|
||||
// read db configuration
|
||||
$sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
|
||||
|
||||
|
||||
$sContent = str_replace ('<?php', '', $sContent);
|
||||
$sContent = str_replace ('<?', '', $sContent);
|
||||
$sContent = str_replace ('?>', '', $sContent);
|
||||
@@ -233,7 +231,7 @@ if (! defined ('SYS_SYS')) {
|
||||
$sContent = str_replace ("('", "$", $sContent);
|
||||
$sContent = str_replace ("',", '=', $sContent);
|
||||
$sContent = str_replace (");", ';', $sContent);
|
||||
|
||||
|
||||
eval ($sContent);
|
||||
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
|
||||
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
|
||||
@@ -265,7 +263,7 @@ if (! defined ('SYS_SYS')) {
|
||||
fclose ($oFile);
|
||||
Propel::init (PATH_CORE . 'config/_databases_.php');
|
||||
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
|
||||
|
||||
|
||||
eprintln ("Processing workspace: " . $sObject, 'green');
|
||||
try {
|
||||
processWorkspace ();
|
||||
@@ -295,16 +293,16 @@ function processWorkspace()
|
||||
global $SkipRecords;
|
||||
global $TrunkSize;
|
||||
global $appUid;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
G::LoadClass ('AppSolr');
|
||||
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
|
||||
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
|
||||
print "solr_host: " . $solrConf ['solr_host'] . "\n";
|
||||
print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
|
||||
|
||||
|
||||
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
|
||||
if ($ScriptAction == "reindexall") {
|
||||
$oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
|
||||
@@ -319,13 +317,13 @@ function processWorkspace()
|
||||
if($appUid == ""){
|
||||
print "Missing -appuid parameter. please complete it with this option.\n";
|
||||
}
|
||||
$oAppSolr->updateApplicationSearchIndex ($appUid);
|
||||
$oAppSolr->updateApplicationSearchIndex ($appUid, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n");
|
||||
@@ -339,7 +337,7 @@ function saveLog($sSource, $sType, $sDescription)
|
||||
if ($isDebug)
|
||||
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
|
||||
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
|
||||
|
||||
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
@@ -360,7 +358,7 @@ function setExecutionMessage($m)
|
||||
$len = strlen ($m);
|
||||
$linesize = 60;
|
||||
$rOffset = $linesize - $len;
|
||||
|
||||
|
||||
eprint ("* $m");
|
||||
for ($i = 0; $i < $rOffset; $i++)
|
||||
eprint ('.');
|
||||
@@ -375,4 +373,3 @@ function setExecutionResultMessage($m, $t = '')
|
||||
$c = 'yellow';
|
||||
eprintln ("[$m]", $c);
|
||||
}
|
||||
|
||||
|
||||
554
workflow/engine/bin/verify_solr.php
Normal file
554
workflow/engine/bin/verify_solr.php
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -153,7 +153,7 @@ class PMmemcached
|
||||
|
||||
public function delete($key)
|
||||
{
|
||||
if (!$this->connected) {
|
||||
if (! $this->connected || $this->class == 'filecache') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class PMmemcached
|
||||
|
||||
public function flush()
|
||||
{
|
||||
if (!$this->connected) {
|
||||
if (! $this->connected || $this->class == 'filecache') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class PMmemcached
|
||||
|
||||
public function getStats()
|
||||
{
|
||||
if (!$this->connected) {
|
||||
if (! $this->connected || $this->class == 'filecache') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,13 +180,13 @@ class PMmemcached
|
||||
|
||||
public function printDetails()
|
||||
{
|
||||
if (!$this->connected) {
|
||||
if (! $this->connected || $this->class == 'filecache') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = $this->mem->getStats();
|
||||
|
||||
if (!is_array($status)) {
|
||||
if (! is_array($status)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,43 +1,43 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
* Application Solr Queue
|
||||
*/
|
||||
class Entity_AppSolrQueue extends Entity_Base
|
||||
{
|
||||
public $appUid = "";
|
||||
public $appChangeDate = "";
|
||||
public $appChangeTrace = "";
|
||||
public $appUpdated = 0;
|
||||
public $appUid = '';
|
||||
public $appChangeDate = '';
|
||||
public $appChangeTrace = '';
|
||||
public $appUpdated = 0;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"appUid",
|
||||
"appChangeDate",
|
||||
"appChangeTrace",
|
||||
"appUpdated"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_AppSolrQueue();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array(
|
||||
"appUid",
|
||||
"appChangeDate",
|
||||
"appChangeTrace",
|
||||
"appUpdated"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,51 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
* Facet group entity that represent a facet group
|
||||
*
|
||||
* @property $facetGroupName: The name of the facet (field name in solr index)
|
||||
* @property $facetGroupPrintName: The print name of the facet (Human readable
|
||||
* description)
|
||||
* description)
|
||||
* @property $facetGroupType: The type of facet group, field, daterange, filter,
|
||||
* range
|
||||
* range
|
||||
* @property $facetGroupId: An identifier to find group information
|
||||
* @property $facetItems: array of facet items
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Entity_FacetGroup extends Entity_Base
|
||||
{
|
||||
public $facetGroupName = '';
|
||||
public $facetGroupPrintName = '';
|
||||
public $facetGroupType = ''; // field, daterange, query
|
||||
public $facetGroupId = '';
|
||||
public $facetItems = array ();
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_FacetGroup();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert ($data)
|
||||
{
|
||||
$obj = new Entity_FacetGroup();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("facetGroupName","facetItems"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $facetGroupName = '';
|
||||
public $facetGroupPrintName = '';
|
||||
public $facetGroupType = ''; // field, daterange, query
|
||||
public $facetGroupId = '';
|
||||
public $facetItems = array ();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetGroup ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert($data)
|
||||
{
|
||||
$obj = new Entity_FacetGroup ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"facetGroupName",
|
||||
"facetItems"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_FacetInterfaceRequest extends Entity_Base
|
||||
{
|
||||
public $searchText = '';
|
||||
public $selectedFacetsString = ''; // string of selected facet groups and
|
||||
|
||||
// items in format:
|
||||
// groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2,
|
||||
// groupkey3::groupdesc3:::itemkey3::itemdesc3
|
||||
// var $selectedFacetFields = array();
|
||||
// var $selectedFacetTypes = array();
|
||||
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("searchText","selectedFacetsString"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $searchText = '';
|
||||
public $selectedFacetsString = ''; // string of selected facet groups and
|
||||
// items in format:
|
||||
// groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2,
|
||||
// groupkey3::groupdesc3:::itemkey3::itemdesc3
|
||||
// var $selectedFacetFields = array();
|
||||
// var $selectedFacetTypes = array();
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceRequest ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"searchText",
|
||||
"selectedFacetsString"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_FacetInterfaceResult extends Entity_Base
|
||||
{
|
||||
// array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text
|
||||
|
||||
|
||||
public $aFacetGroup = array ();
|
||||
public $aSelectedFacetGroupItem = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("aFacetGroup","aSelectedFacetGroupItem","sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
// array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text
|
||||
|
||||
public $aFacetGroup = array ();
|
||||
public $aSelectedFacetGroupItem = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetInterfaceResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"aFacetGroup",
|
||||
"aSelectedFacetGroupItem",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +1,47 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Entity Face item, represent an option in a facet group
|
||||
*
|
||||
* @author dev-HebertSaak
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Entity_FacetItem extends Entity_Base
|
||||
{
|
||||
public $facetName = '';
|
||||
public $facetPrintName = '';
|
||||
public $facetCount = '';
|
||||
public $facetSelectCondition = ''; // selected condition used to select
|
||||
|
||||
// this facet
|
||||
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_FacetItem();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert ($data)
|
||||
{
|
||||
$obj = new Entity_FacetItem();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("facetName","facetCount"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $facetName = '';
|
||||
public $facetPrintName = '';
|
||||
public $facetCount = '';
|
||||
public $facetSelectCondition = ''; // selected condition used to select
|
||||
// this facet
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetItem ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForInsert($data)
|
||||
{
|
||||
$obj = new Entity_FacetItem ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"facetName",
|
||||
"facetCount"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +1,43 @@
|
||||
<?php
|
||||
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_FacetRequest extends Entity_Base
|
||||
{
|
||||
public $workspace = '';
|
||||
public $searchText = '';
|
||||
public $facetFields = array ();
|
||||
public $facetQueries = array ();
|
||||
public $facetDates = array ();
|
||||
public $facetDatesStart = '';
|
||||
public $facetDatesEnd = '';
|
||||
public $facetDateGap = '';
|
||||
public $facetRanges = array ();
|
||||
public $filters = array ();
|
||||
public $selectedFacetsString = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"workspace"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public $workspace = '';
|
||||
public $searchText = '';
|
||||
public $facetFields = array();
|
||||
public $facetQueries = array();
|
||||
public $facetDates = array();
|
||||
public $facetDatesStart = '';
|
||||
public $facetDatesEnd = '';
|
||||
public $facetDateGap = '';
|
||||
public $facetRanges = array();
|
||||
public $filters = array();
|
||||
public $selectedFacetsString = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetRequest ();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
"workspace"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +1,37 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_FacetResult extends Entity_Base
|
||||
{
|
||||
public $aFacetGroups = array ();
|
||||
public $aSelectedFacetGroups = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_FacetResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_FacetResult();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("aFacetGroups","aSelectedFacetGroups","sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $aFacetGroups = array ();
|
||||
public $aSelectedFacetGroups = array ();
|
||||
public $sFilterText = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_FacetResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_FacetResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"aFacetGroups",
|
||||
"aSelectedFacetGroups",
|
||||
"sFilterText"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_SelectedFacetGroupItem extends Entity_Base
|
||||
{
|
||||
public $selectedFacetGroupName = '';
|
||||
public $selectedFacetGroupPrintName = '';
|
||||
public $selectedFacetItemName = '';
|
||||
public $selectedFacetItemPrintName = '';
|
||||
public $selectedFacetRemoveCondition = ''; // remove condition, string of
|
||||
|
||||
// selected facets without this
|
||||
// facet
|
||||
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("selectedFacetGroupName","selectedFacetItemName"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $selectedFacetGroupName = '';
|
||||
public $selectedFacetGroupPrintName = '';
|
||||
public $selectedFacetItemName = '';
|
||||
public $selectedFacetItemPrintName = '';
|
||||
public $selectedFacetRemoveCondition = ''; // remove condition, string of
|
||||
// selected facets without this
|
||||
// facet
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SelectedFacetGroupItem ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"selectedFacetGroupName",
|
||||
"selectedFacetItemName"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +1,40 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_SolrQueryResult extends Entity_Base
|
||||
{
|
||||
public $sEcho = '';
|
||||
public $iTotalRecords = 0;
|
||||
public $iTotalDisplayRecords = 10;
|
||||
public $aaData = array (); // array of arrays of records to
|
||||
|
||||
// display
|
||||
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ('sEcho','iTotalRecords','iTotalDisplayRecords','aaData'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
public $sEcho = '';
|
||||
public $iTotalRecords = 0;
|
||||
public $iTotalDisplayRecords = 10;
|
||||
public $aaData = array (); // array of arrays of records to
|
||||
// display
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SolrQueryResult ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
'sEcho',
|
||||
'iTotalRecords',
|
||||
'iTotalDisplayRecords',
|
||||
'aaData'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +1,46 @@
|
||||
<?php
|
||||
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_SolrRequestData extends Entity_Base
|
||||
{
|
||||
public $workspace = '';
|
||||
public $startAfter = 0;
|
||||
public $pageSize = 10;
|
||||
public $searchText = '*:*';
|
||||
public $filterText = ''; // comma separated list of filters field:value
|
||||
public $numSortingCols = 0; // number of columns that are sorted
|
||||
public $sortableCols = array (); // array of booleans indicating if column is
|
||||
// sortable (true, false)
|
||||
public $sortCols = array (); // array of indices of sorted columns index
|
||||
// based in the total number of sorting cols
|
||||
public $sortDir = array (); // array of direction of sorting for each
|
||||
// column (desc, asc)
|
||||
public $includeCols = array ();
|
||||
public $resultFormat = 'xml'; // json, xml, php
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequestPagination($data)
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
'workspace'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public $workspace = '';
|
||||
public $startAfter = 0;
|
||||
public $pageSize = 10;
|
||||
public $searchText = '*:*';
|
||||
public $filterText = ''; // comma separated list of filters field:value
|
||||
public $numSortingCols = 0; // number of columns that are sorted
|
||||
public $sortableCols = array(); // array of booleans indicating if column is
|
||||
// sortable (true, false)
|
||||
public $sortCols = array(); // array of indices of sorted columns index
|
||||
// based in the total number of sorting cols
|
||||
public $sortDir = array(); // array of direction of sorting for each
|
||||
// column (desc, asc)
|
||||
public $includeCols = array();
|
||||
public $resultFormat = 'xml'; // json, xml, php
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public static function createForRequestPagination($data)
|
||||
{
|
||||
$obj = new Entity_SolrRequestData ();
|
||||
|
||||
$obj->initializeObject($data);
|
||||
|
||||
$requiredFields = array(
|
||||
'workspace'
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +1,35 @@
|
||||
<?php
|
||||
//require_once ('Base.php');
|
||||
require_once ('Base.php');
|
||||
|
||||
class Entity_SolrUpdateDocument extends Entity_Base
|
||||
{
|
||||
var $workspace = '';
|
||||
var $document = '';
|
||||
|
||||
private function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty ()
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest ($data)
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument();
|
||||
|
||||
$obj->initializeObject( $data );
|
||||
|
||||
$requiredFields = array ("workspace","document"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields( $requiredFields );
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
var $workspace = '';
|
||||
var $document = '';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
static function createEmpty()
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument ();
|
||||
return $obj;
|
||||
}
|
||||
|
||||
static function createForRequest($data)
|
||||
{
|
||||
$obj = new Entity_SolrUpdateDocument ();
|
||||
|
||||
$obj->initializeObject ($data);
|
||||
|
||||
$requiredFields = array (
|
||||
"workspace",
|
||||
"document"
|
||||
);
|
||||
|
||||
$obj->validateRequiredFields ($requiredFields);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,22 +81,30 @@ class AppSolrQueue extends BaseAppSolrQueue
|
||||
* Returns the list of updated applications
|
||||
* array of Entity_AppSolrQueue
|
||||
*/
|
||||
public function getListUpdatedApplications ()
|
||||
public function getListUpdatedApplications($updated = true, $deleted = true)
|
||||
{
|
||||
$updatedApplications = array ();
|
||||
try {
|
||||
$c = new Criteria();
|
||||
|
||||
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_UID);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
|
||||
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
|
||||
|
||||
//"WHERE
|
||||
$c->add( AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL );
|
||||
|
||||
$rs = AppSolrQueuePeer::doSelectRS( $c );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
//"WHERE
|
||||
if($updated == true && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL);
|
||||
}
|
||||
if($updated == true && $deleted == false){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 1, Criteria::EQUAL);
|
||||
}
|
||||
if($updated == false && $deleted == true){
|
||||
$c->add(AppSolrQueuePeer::APP_UPDATED, 2, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = AppSolrQueuePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
//echo $c->toString();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
@@ -111,11 +119,11 @@ class AppSolrQueue extends BaseAppSolrQueue
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
|
||||
return $updatedApplications;
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // AppSolrQueue
|
||||
|
||||
@@ -181,10 +181,8 @@ function getAllCounters ()
|
||||
G::LoadClass( 'AppSolr' );
|
||||
$ApplicationSolrIndex = new AppSolr( $solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance'] );
|
||||
|
||||
if ($ApplicationSolrIndex->isSolrEnabled()) {
|
||||
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
|
||||
$solrEnabled = true;
|
||||
} else {
|
||||
$solrEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ try {
|
||||
$solrConf["solr_instance"]
|
||||
);
|
||||
|
||||
if ($ApplicationSolrIndex->isSolrEnabled()) {
|
||||
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
|
||||
//Check if there are missing records to reindex and reindex them
|
||||
$ApplicationSolrIndex->synchronizePendingApplications();
|
||||
$solrEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user