|
@@ -627,6 +627,22 @@ try
|
|
|
$iBlock = 0;
|
|
|
// Search in full text mode in all the classes
|
|
|
$aMatches = array();
|
|
|
+ $sClassName = '';
|
|
|
+
|
|
|
+ // Check if a class name/label is supplied to limit the search
|
|
|
+ if (preg_match('/^(.+):(.+)$/', $sFullText, $aMatches))
|
|
|
+ {
|
|
|
+ $sClassName = $aMatches[1];
|
|
|
+ if (MetaModel::IsValidClass($sClassName))
|
|
|
+ {
|
|
|
+ $sFullText = $aMatches[2];
|
|
|
+ }
|
|
|
+ elseif ($sClassName = MetaModel::GetClassFromLabel($sClassName, false /* => not case sensitive */))
|
|
|
+ {
|
|
|
+ $sFullText = $aMatches[2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (preg_match('/^"(.*)"$/', $sFullText, $aMatches))
|
|
|
{
|
|
|
// The text is surrounded by double-quotes, remove the quotes and treat it as one single expression
|
|
@@ -637,7 +653,18 @@ try
|
|
|
// Split the text on the blanks and treat this as a search for <word1> AND <word2> AND <word3>
|
|
|
$aFullTextNeedles = explode(' ', $sFullText);
|
|
|
}
|
|
|
- foreach(MetaModel::GetClasses('searchable') as $sClassName)
|
|
|
+
|
|
|
+ // Search is limited ot a given class, or not...
|
|
|
+ if (empty($sClassName))
|
|
|
+ {
|
|
|
+ $aSearchClasses = MetaModel::GetClasses('searchable');
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $aSearchClasses = MetaModel::EnumChildClasses($sClassName, ENUM_CHILD_CLASSES_ALL);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach($aSearchClasses as $sClassName)
|
|
|
{
|
|
|
$oFilter = new DBObjectSearch($sClassName);
|
|
|
foreach($aFullTextNeedles as $sSearchText)
|