BUG 0000 herbert> SOLR implementation in PMOS2
Solr support in PMOS2 includes:
Functionality:
- Implementation of Home views (Inbox, Draft, Participated, Unassigned). The views return fast results.
- Include read, unread, all, and process filter in inbox View.
- Include process filter in draft view.
- Include started by me, completed by me, all, process, and status filter in participated view.
- Include process filter in unassigned view.
- Improved search functionality (search in user defined variables): Use the following syntax to search in process (user defined) variables. {variable_name}:{search_word} ex1:"causal:20*" where causal is the variable defined by the user.
+ Use of wildcards in search: Use * as wildcard at the begin or end of word
+ Multiple conditions in search: Separate multiple conditions by space ex2:"Materiales causal:20*" means that we are searching for the word Materiales and the causal that begin with 20.
+ Search in dates (interval ): Format=> {variable_date}:[yyyy-mm-dd TO yyyy-mm-dd]
Local date not UTC date required
ex: FechaRegistro:[2011-04-15 TO 2011-04-30] //registros con fecha entre el 2011-04-15 y el 2011-04-30.
+ we can use the wildcard *:
ex: FechaRegistro:[* TO 2011-04-30] //registros con fecha menor o igual a 2011-04-30.
FechaRegistro:[2011-04-15 TO *] //registros con fecha mayor o igual a 2011-04-15.
+ Search of exact phrases. format: {variable}:"frase a buscar"
ex: Cliente:"Jesus Marin"
- Application update function.
+ The function is called every time a change is detected in the application's data including the related delegations.
- Use of cache to improve performance
Not included:
- Order of task, sent by, and due date columns.
Pending:
- Advanced search view using faceted lists.
This commit is contained in:
@@ -833,6 +833,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function updateCase($sAppUid, $Fields = array()) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$aApplicationFields = $Fields['APP_DATA'];
|
||||
$Fields['APP_UID'] = $sAppUid;
|
||||
@@ -920,7 +923,9 @@ class Cases {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update Solr Index
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
return $Fields;
|
||||
}
|
||||
catch (exception $e) {
|
||||
@@ -937,6 +942,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function removeCase($sAppUid) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$oApplication = new Application();
|
||||
$oAppDelegation = new AppDelegation();
|
||||
@@ -990,7 +998,12 @@ class Cases {
|
||||
$oCriteria2->add(SubApplicationPeer::APP_PARENT, $sAppUid);
|
||||
SubApplicationPeer::doDelete($oCriteria2);
|
||||
$oApp = new Application;
|
||||
return $oApp->remove($sAppUid);
|
||||
$result = $oApp->remove($sAppUid);
|
||||
|
||||
//delete application from index
|
||||
$appSolr->deleteApplicationSearchIndex($sAppUid);
|
||||
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1006,10 +1019,15 @@ class Cases {
|
||||
*/
|
||||
|
||||
function setDelInitDate($sAppUid, $iDelIndex) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
|
||||
$oAppDel->setDelInitDate("now");
|
||||
$oAppDel->save();
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1026,11 +1044,17 @@ class Cases {
|
||||
*/
|
||||
|
||||
function setCatchUser($sAppUid, $iDelIndex, $usrId) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
|
||||
$oAppDel->setDelInitDate("now");
|
||||
$oAppDel->setUsrUid($usrId);
|
||||
$oAppDel->save();
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1436,9 +1460,15 @@ class Cases {
|
||||
*/
|
||||
|
||||
function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel=null) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$appDel = new AppDelegation();
|
||||
return $appDel->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel);
|
||||
$result = $appDel->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel);
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
return $result;
|
||||
}
|
||||
catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1457,6 +1487,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$appDelegation = new AppDelegation();
|
||||
$aData = array();
|
||||
@@ -1465,6 +1498,9 @@ class Cases {
|
||||
$aData['DEL_THREAD'] = $iAppThreadIndex;
|
||||
|
||||
$appDelegation->update($aData);
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
return true;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1540,6 +1576,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function updateAppThread($sAppUid, $iAppThreadIndex, $iNewDelIndex) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
/// updating the DEL_INDEX value in the APP_THREAD
|
||||
$con = Propel::getConnection('workflow');
|
||||
@@ -1559,6 +1598,9 @@ class Cases {
|
||||
$aData['DEL_INDEX'] = $iNewDelIndex;
|
||||
$appThread->update($aData);
|
||||
*/
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
return $iNewDelIndex;
|
||||
}
|
||||
catch (exception $e) {
|
||||
@@ -1576,6 +1618,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function closeAppThread($sAppUid, $iAppThreadIndex) {
|
||||
// //initialize solrindex object called from other functions
|
||||
// G::LoadClass('AppSolr');
|
||||
// $appSolr = new AppSolr();
|
||||
try {
|
||||
$appThread = new AppThread();
|
||||
$aData = array();
|
||||
@@ -1584,6 +1629,8 @@ class Cases {
|
||||
$aData['APP_THREAD_STATUS'] = 'CLOSED';
|
||||
|
||||
$appThread->update($aData);
|
||||
// //update searchindex
|
||||
// $appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
return true;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -1599,6 +1646,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function closeAllThreads($sAppUid) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
@@ -1616,6 +1666,8 @@ class Cases {
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1633,9 +1685,15 @@ class Cases {
|
||||
*/
|
||||
|
||||
function newAppThread($sAppUid, $iNewDelIndex, $iAppParent) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
$appThread = new AppThread();
|
||||
return $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent);
|
||||
$result = $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent);
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1650,6 +1708,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function closeAllDelegations($sAppUid) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
@@ -1667,6 +1728,8 @@ class Cases {
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1682,6 +1745,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function CloseCurrentDelegation($sAppUid, $iDelIndex) {
|
||||
//called from other functions
|
||||
// //initialize solrindex object
|
||||
// G::LoadClass('AppSolr');
|
||||
// $appSolr = new AppSolr();
|
||||
try {
|
||||
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
|
||||
$c = new Criteria();
|
||||
@@ -1703,6 +1770,9 @@ class Cases {
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
// //update searchindex
|
||||
// $appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1719,6 +1789,9 @@ class Cases {
|
||||
*/
|
||||
|
||||
function ReactivateCurrentDelegation($sAppUid, $iDelegation) {
|
||||
// //initialize solrindex object called from other function
|
||||
// G::LoadClass('AppSolr');
|
||||
// $appSolr = new AppSolr();
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
@@ -1737,6 +1810,8 @@ class Cases {
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
}
|
||||
// //update searchindex
|
||||
// $appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -1754,7 +1829,11 @@ class Cases {
|
||||
|
||||
function startCase($sTasUid, $sUsrUid, $isSubprocess=false) {
|
||||
if ($sTasUid != '') {
|
||||
try {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
try {
|
||||
$this->Task = new Task;
|
||||
$Fields = $this->Task->Load($sTasUid);
|
||||
|
||||
@@ -1795,6 +1874,8 @@ class Cases {
|
||||
G::LoadClass('derivation');
|
||||
$oDerivation = new Derivation();
|
||||
$oDerivation->setTasLastAssigned($sTasUid, $sUsrUid);
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
@@ -3341,6 +3422,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
|
||||
$oApplication = new Application();
|
||||
$aFields = $oApplication->Load($sApplicationUID);
|
||||
@@ -3368,6 +3453,9 @@ class Cases {
|
||||
$aData['APP_DISABLE_ACTION_DATE'] = $sUnpauseDate;
|
||||
$oAppDelay = new AppDelay();
|
||||
$oAppDelay->create($aData);
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3427,6 +3515,9 @@ class Cases {
|
||||
$aData['APP_DISABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
|
||||
$oAppDelay = new AppDelay();
|
||||
$aFieldsDelay = $oAppDelay->update($aData);
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3440,6 +3531,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function cancelCase($sApplicationUID, $iIndex, $user_logged) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
$oApplication = new Application();
|
||||
$aFields = $oApplication->load($sApplicationUID);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -3496,6 +3591,9 @@ class Cases {
|
||||
$oDerivation = new Derivation();
|
||||
$oDerivation->verifyIsCaseChild($sApplicationUID);
|
||||
}
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3509,6 +3607,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function reactivateCase($sApplicationUID, $iIndex, $user_logged) {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
$oApplication = new Application();
|
||||
$aFields = $oApplication->load((isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION']));
|
||||
$aFields['APP_STATUS'] = 'TO_DO';
|
||||
@@ -3542,6 +3644,9 @@ class Cases {
|
||||
$sql = "UPDATE APP_THREAD SET APP_THREAD_STATUS = 'OPEN' WHERE APP_UID = '$sApplicationUID' AND DEL_INDEX ='$iIndex' ";
|
||||
$stmt = $con->createStatement();
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3557,6 +3662,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN') {
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
|
||||
$oAppDelegation = new AppDelegation();
|
||||
$aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation);
|
||||
@@ -3589,6 +3698,10 @@ class Cases {
|
||||
$aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
|
||||
$oAppDelay = new AppDelay();
|
||||
$oAppDelay->create($aData);
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($sApplicationUID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5040,6 +5153,10 @@ class Cases {
|
||||
*/
|
||||
|
||||
function executeTriggersAfterExternal($sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData = array()) {
|
||||
// //initialize solrindex object UpdateCase añready calls the update
|
||||
// G::LoadClass('AppSolr');
|
||||
// $appSolr = new AppSolr();
|
||||
|
||||
//load the variables
|
||||
$Fields = $this->loadCase($sApplication);
|
||||
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
||||
@@ -5056,6 +5173,9 @@ class Cases {
|
||||
$aData['DEL_INDEX'] = $iIndex;
|
||||
$aData['TAS_UID'] = $sTask;
|
||||
$this->updateCase($sApplication, $aData);
|
||||
|
||||
// //update searchindex
|
||||
// $appSolr->updateApplicationSearchIndex($sApplication);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5408,11 +5528,18 @@ class Cases {
|
||||
}
|
||||
|
||||
function discriminateCases($aData){
|
||||
//initialize solrindex object
|
||||
G::LoadClass('AppSolr');
|
||||
$appSolr = new AppSolr();
|
||||
|
||||
$siblingThreadData = $this->GetAllOpenDelegation($aData);
|
||||
foreach($siblingThreadData as $thread => $threadData)
|
||||
{
|
||||
$this->closeAppThread ( $aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppThreads
|
||||
$this->CloseCurrentDelegation ($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppDelegations
|
||||
|
||||
//update searchindex
|
||||
$appSolr->updateApplicationSearchIndex($aData['APP_UID']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user