protected function applyFilterFields(baseObjectFilter $filter)
 {
     /* @var $filter cuePointFilter */
     // Reduce the cache expiry when fetching live stream cuepoints
     $entryId = $filter->get('_in_entry_id');
     if ($entryId && strpos($entryId, ',') === false) {
         $entry = entryPeer::retrieveByPK($entryId);
         if ($entry && $entry->getType() == entryType::LIVE_STREAM) {
             kApiCache::setExpiry(self::LIVE_ENTRY_CUE_POINT_CACHE_EXPIRY_SECONDS);
         }
     }
     if ($filter->get('_free_text')) {
         $this->sphinxSkipped = false;
         $freeTexts = $filter->get('_free_text');
         KalturaLog::debug("Attach free text [{$freeTexts}]");
         $this->addFreeTextToMatchClauseByMatchFields($freeTexts, CuePointFilter::FREE_TEXT_FIELDS);
     }
     $filter->unsetByName('_free_text');
     if ($filter->get('_eq_is_public')) {
         $this->sphinxSkipped = false;
         $isPublic = $filter->get('_eq_is_public');
         $this->addCondition('is_public' . " = " . $isPublic);
     }
     $filter->unsetByName('_eq_is_public');
     return parent::applyFilterFields($filter);
 }
Esempio n. 2
0
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     if ($filter->get('_eq_object_type')) {
         $filter->set('_eq_object_type', Tag::getIndexedFieldValue('TagPeer::OBJECT_TYPE', $filter->get('_eq_object_type'), kCurrentContext::getCurrentPartnerId()));
     }
     if ($filter->get('_likex_tag')) {
         /*
          * We replace the spaces with '=' because when we index the tags we also replace them this way. This way when we search the sphinx for expressions using spaces that the first word in them is less than 3 letters
          * we can still find them.
          */
         $filter->set('_likex_tag', str_replace(" ", "=", $filter->get('_likex_tag')));
     }
     parent::applyFilterFields($filter);
 }
Esempio n. 3
0
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     //Role ids and kuser permission names are indexed with the partner ID
     if ($filter->get('_eq_role_ids')) {
         $filter->set('_eq_role_ids', kuser::getIndexedFieldValue('kuserPeer::ROLE_IDS', $filter->get('_eq_role_ids'), kCurrentContext::getCurrentPartnerId()));
     }
     if ($filter->get('_in_role_ids')) {
         $filter->set('_eq_role_ids', kuser::getIndexedFieldValue('kuserPeer::ROLE_IDS', $filter->get('_eq_role_ids'), kCurrentContext::getCurrentPartnerId()));
     }
     if ($filter->get('_mlikeand_permission_names')) {
         $permissionNames = kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', $filter->get('_mlikeand_permission_names'), kCurrentContext::getCurrentPartnerId());
         $permissionNames = implode(' ', explode(',', $permissionNames));
         $universalPermissionName = kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', kuser::UNIVERSAL_PERMISSION, kCurrentContext::getCurrentPartnerId());
         $value = "({$universalPermissionName} | ({$permissionNames}))";
         $this->addMatch("@permission_names {$value}");
         $filter->unsetByName('_mlikeand_permission_names');
     }
     if ($filter->get('_mlikeor_permission_names')) {
         $filter->set('_mlikeor_permission_names', kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', $filter->get('_mlikeor_permission_names') . ',' . kuser::UNIVERSAL_PERMISSION, kCurrentContext::getCurrentPartnerId()));
     }
     if ($filter->get('_likex_puser_id_or_screen_name')) {
         $freeTexts = $filter->get('_likex_puser_id_or_screen_name');
         KalturaLog::debug("Attach free text [{$freeTexts}]");
         $additionalConditions = array();
         $advancedSearch = $filter->getAdvancedSearch();
         if ($advancedSearch) {
             $additionalConditions = $advancedSearch->getFreeTextConditions($filter->getPartnerSearchScope(), $freeTexts);
         }
         $this->addFreeTextToMatchClauseByMatchFields($freeTexts, kuserFilter::PUSER_ID_OR_SCREEN_NAME, $additionalConditions, true);
     }
     $filter->unsetByName('_likex_puser_id_or_screen_name');
     if ($filter->get('_likex_first_name_or_last_name')) {
         $names = $filter->get('_likex_first_name_or_last_name');
         KalturaLog::debug("Attach free text [{$names}]");
         $this->addFreeTextToMatchClauseByMatchFields($names, kuserFilter::FIRST_NAME_OR_LAST_NAME, null, true);
     }
     $filter->unsetByName('_likex_first_name_or_last_name');
     return parent::applyFilterFields($filter);
 }
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     //Role ids and kuser permission names are indexed with the partner ID
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     if ($filter->get('_eq_role_ids')) {
         $filter->set('_eq_role_ids', kuser::getIndexedFieldValue('kuserPeer::ROLE_IDS', $filter->get('_eq_role_ids'), $partnerId));
     }
     if ($filter->get('_in_role_ids')) {
         $filter->set('_eq_role_ids', kuser::getIndexedFieldValue('kuserPeer::ROLE_IDS', $filter->get('_eq_role_ids'), $partnerId));
     }
     if ($filter->get('_mlikeand_permission_names')) {
         $permissionNames = kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', $filter->get('_mlikeand_permission_names'), $partnerId);
         $permissionNames = implode(' ', explode(',', $permissionNames));
         $universalPermissionName = kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', kuser::UNIVERSAL_PERMISSION, $partnerId);
         $value = "({$universalPermissionName} | ({$permissionNames}))";
         $this->addMatch("@permission_names {$value}");
         $filter->unsetByName('_mlikeand_permission_names');
     }
     if ($filter->get('_mlikeor_permission_names')) {
         $filter->set('_mlikeor_permission_names', kuser::getIndexedFieldValue('kuserPeer::PERMISSION_NAMES', $filter->get('_mlikeor_permission_names') . ',' . kuser::UNIVERSAL_PERMISSION, $partnerId));
     }
     if ($filter->get('_likex_puser_id_or_screen_name')) {
         $freeTexts = $filter->get('_likex_puser_id_or_screen_name');
         KalturaLog::debug("Attach free text [{$freeTexts}]");
         $additionalConditions = array();
         $advancedSearch = $filter->getAdvancedSearch();
         if ($advancedSearch) {
             $additionalConditions = $advancedSearch->getFreeTextConditions($freeTexts);
         }
         if (preg_match('/^"[^"]+"$/', $freeTexts)) {
             $freeText = str_replace('"', '', $freeTexts);
             $freeText = SphinxUtils::escapeString($freeText);
             $freeText = "^{$freeText}\$";
             $additionalConditions[] = "@(" . kuserFilter::PUSER_ID_OR_SCREEN_NAME . ") {$freeText}\\\\*";
         } else {
             if (strpos($freeTexts, baseObjectFilter::IN_SEPARATOR) > 0) {
                 str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 $freeTextsArr = explode(baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 foreach ($freeTextsArr as $freeText) {
                     $additionalConditions[] = "@(" . kuserFilter::PUSER_ID_OR_SCREEN_NAME . ") {$freeText}\\\\*";
                 }
             } else {
                 $freeTextsArr = explode(baseObjectFilter::AND_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 $freeTextsArr = array_unique($freeTextsArr);
                 $freeTextExpr = implode(baseObjectFilter::AND_SEPARATOR, $freeTextsArr);
                 $additionalConditions[] = "@(" . kuserFilter::PUSER_ID_OR_SCREEN_NAME . ") {$freeTextExpr}\\\\*";
             }
         }
         if (count($additionalConditions)) {
             $additionalConditions = array_unique($additionalConditions);
             $matches = reset($additionalConditions);
             if (count($additionalConditions) > 1) {
                 $matches = '( ' . implode(' ) | ( ', $additionalConditions) . ' )';
             }
             $this->matchClause[] = $matches;
         }
     }
     $filter->unsetByName('_likex_puser_id_or_screen_name');
     if ($filter->get('_likex_first_name_or_last_name')) {
         $names = $filter->get('_likex_first_name_or_last_name');
         KalturaLog::debug("Attach free text [{$names}]");
         $additionalConditions = array();
         if (preg_match('/^"[^"]+"$/', $names)) {
             $name = str_replace('"', '', $names);
             $name = SphinxUtils::escapeString($name);
             $name = "^{$name}\$";
             $additionalConditions[] = "@(" . kuserFilter::FIRST_NAME_OR_LAST_NAME . ") {$name}\\\\*";
         } else {
             if (strpos($names, baseObjectFilter::IN_SEPARATOR) > 0) {
                 str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $names);
                 $namesArr = explode(baseObjectFilter::IN_SEPARATOR, $names);
                 foreach ($namesArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($namesArr[$valIndex]);
                     } else {
                         $namesArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 foreach ($namesArr as $name) {
                     $additionalConditions[] = "@(" . kuserFilter::FIRST_NAME_OR_LAST_NAME . ") {$name}\\\\*";
                 }
             } else {
                 $namesArr = explode(baseObjectFilter::AND_SEPARATOR, $names);
                 foreach ($namesArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($namesArr[$valIndex]);
                     } else {
                         $namesArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 $namesArr = array_unique($namesArr);
                 $nameExpr = implode(baseObjectFilter::AND_SEPARATOR, $namesArr);
                 $additionalConditions[] = "@(" . kuserFilter::FIRST_NAME_OR_LAST_NAME . ") {$nameExpr}\\\\*";
             }
         }
         if (count($additionalConditions)) {
             $additionalConditions = array_unique($additionalConditions);
             $matches = reset($additionalConditions);
             if (count($additionalConditions) > 1) {
                 $matches = '( ' . implode(' ) | ( ', $additionalConditions) . ' )';
             }
             $this->matchClause[] = $matches;
         }
     }
     $filter->unsetByName('_likex_first_name_or_last_name');
     return parent::applyFilterFields($filter);
 }
Esempio n. 5
0
 public function translateSphinxCriterion(SphinxCriterion $crit)
 {
     $field = $crit->getTable() . '.' . $crit->getColumn();
     if ($field == categoryPeer::FULL_NAME && $crit->getComparison() == Criteria::EQUAL) {
         return array(categoryPeer::FULL_NAME, Criteria::LIKE, $crit->getValue() . category::FULL_NAME_EQUAL_MATCH_STRING);
     } else {
         if ($field == categoryPeer::FULL_NAME && $crit->getComparison() == Criteria::IN) {
             return array(categoryPeer::FULL_NAME, Criteria::IN_LIKE, kString::addSuffixToArray($crit->getValue(), category::FULL_NAME_EQUAL_MATCH_STRING));
         } else {
             if ($field == categoryPeer::DISPLAY_IN_SEARCH && $crit->getComparison() == Criteria::EQUAL) {
                 $partnerId = kCurrentContext::getCurrentPartnerId();
                 return array(categoryPeer::DISPLAY_IN_SEARCH, Criteria::EQUAL, $crit->getValue() . "P" . $partnerId);
             }
         }
     }
     return parent::translateSphinxCriterion($crit);
 }
Esempio n. 6
0
 public function getFieldPrefix($fieldName)
 {
     if ($fieldName == 'roots') {
         return entry::ROOTS_FIELD_PREFIX;
     }
     if ($fieldName == 'categories') {
         return entry::CATEGORIES_INDEXED_FIELD_PREFIX . kCurrentContext::getCurrentPartnerId();
     }
     return parent::getFieldPrefix($fieldName);
 }
 public function addAnd($p1, $p2 = null, $p3 = null)
 {
     if (is_null($p3)) {
         return parent::addAnd($p1, $p2, $p3);
     }
     // addAnd(column, value, comparison)
     $nc = new SphinxCriterion('SphinxEntryDistributionCriteria', $this, $p1, $p2, $p3);
     $oc = $this->getCriterion($p1);
     if (!is_null($oc)) {
         // no need to add again
         if ($oc->getValue() != $p2 || $oc->getComparison() != $p3) {
             $oc->addAnd($nc);
         }
         return $this;
     }
     return $this->add($nc);
 }
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     $categories = $filter->get("_matchor_likex_full_name");
     if ($categories !== null) {
         $categories = explode(',', $categories);
         $parsedCategories = array();
         foreach ($categories as $category) {
             if (trim($category) == '') {
                 continue;
             }
             $parsedCategories[] = $category . '\\*';
         }
         $fullNameMatchOr = '';
         if (count($parsedCategories)) {
             $fullNameMatchOr = implode(',', $parsedCategories);
         }
         if ($fullNameMatchOr != '') {
             $filter->set("_matchor_full_name", $fullNameMatchOr);
         }
     }
     $filter->unsetByName('_matchor_likex_full_name');
     if ($filter->get('_free_text')) {
         $freeTexts = $filter->get('_free_text');
         KalturaLog::debug("Attach free text [{$freeTexts}]");
         $additionalConditions = array();
         $advancedSearch = $filter->getAdvancedSearch();
         if ($advancedSearch) {
             $additionalConditions = $advancedSearch->getFreeTextConditions($freeTexts);
         }
         if (preg_match('/^"[^"]+"$/', $freeTexts)) {
             $freeText = str_replace('"', '', $freeTexts);
             $freeText = SphinxUtils::escapeString($freeText);
             $freeText = "^{$freeText}\$";
             $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeText}";
         } else {
             if (strpos($freeTexts, baseObjectFilter::IN_SEPARATOR) > 0) {
                 str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 $freeTextsArr = explode(baseObjectFilter::IN_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 foreach ($freeTextsArr as $freeText) {
                     $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeText}";
                 }
             } else {
                 $freeTextsArr = explode(baseObjectFilter::AND_SEPARATOR, $freeTexts);
                 foreach ($freeTextsArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($freeTextsArr[$valIndex]);
                     } else {
                         $freeTextsArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 $freeTextsArr = array_unique($freeTextsArr);
                 $freeTextExpr = implode(baseObjectFilter::AND_SEPARATOR, $freeTextsArr);
                 $additionalConditions[] = "@(" . categoryFilter::FREE_TEXT_FIELDS . ") {$freeTextExpr}";
             }
         }
         if (count($additionalConditions)) {
             $additionalConditions = array_unique($additionalConditions);
             $matches = reset($additionalConditions);
             if (count($additionalConditions) > 1) {
                 $matches = '( ' . implode(' ) | ( ', $additionalConditions) . ' )';
             }
             $this->matchClause[] = $matches;
         }
     }
     $filter->unsetByName('_free_text');
     if ($filter->get('_eq_privacy_context') && $filter->get('_eq_privacy_context') == '*') {
         $filter->set('_matchor_privacy_context', kEntitlementUtils::NOT_DEFAULT_CONTEXT);
         $filter->unsetByName('_eq_privacy_context');
     }
     if ($filter->get('_eq_manager')) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $puserId = $filter->get('_eq_manager');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . $manager . '_' . $kuser->getid() . ')';
         }
     }
     $filter->unsetByName('_eq_manager');
     if ($filter->get('_eq_member')) {
         //memeber but not a menager
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $puserId = $filter->get('_eq_member');
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if ($kuser) {
             $manager = category::getPermissionLevelName(CategoryKuserPermissionLevel::MANAGER);
             $member = category::getPermissionLevelName(CategoryKuserPermissionLevel::MEMBER);
             $moderator = category::getPermissionLevelName(CategoryKuserPermissionLevel::MODERATOR);
             $contributor = category::getPermissionLevelName(CategoryKuserPermissionLevel::CONTRIBUTOR);
             $kuserId = $kuser->getid();
             $this->matchClause[] = '(@(' . categoryFilter::MEMBERS . ') ' . "({$member}_{$kuserId} | {$moderator}_{$kuserId} | {$contributor}_{$kuserId} ) !({$manager}_{$kuserId}))";
         }
     }
     $filter->unsetByName('_eq_member');
     if ($filter->get('_eq_full_name')) {
         $filter->set('_matchor_full_name', $filter->get('_eq_full_name') . category::FULL_NAME_EQUAL_MATCH_STRING);
     }
     $filter->unsetByName('_eq_full_name');
     if ($filter->get('_in_full_name')) {
         $fullnames = explode(',', $filter->get('_in_full_name'));
         $fullnameIn = '';
         foreach ($fullnames as $fullname) {
             $fullnameIn .= $fullname . category::FULL_NAME_EQUAL_MATCH_STRING . ',';
         }
         $filter->set('_matchor_full_name', $fullnameIn);
         $filter->unsetByName('_in_full_name');
     }
     $categories = $filter->get("_in_ancestor_id");
     if ($categories !== null) {
         //if the category exist or the category name is an empty string
         $categoriesParsed = $filter->categoryIdsToAllSubCategoriesIdsParsed($categories);
         if ($categoriesParsed !== '' || $categories == '') {
             $filter->set("_likex_full_ids", $categoriesParsed);
         } else {
             $filter->set("_likex_full_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
     }
     $filter->unsetByName('_in_ancestor_id');
     if ($filter->get('_likex_full_ids')) {
         $fullids = explode(',', $filter->get('_likex_full_ids'));
         $fullIdsIn = '';
         foreach ($fullids as $fullid) {
             $fullIdsIn .= $fullid . '\\*,';
         }
         $filter->set('_matchor_full_ids', $fullIdsIn);
         $filter->unsetByName('_likex_full_ids');
     }
     if ($filter->get('_eq_full_ids')) {
         $filter->set('_matchor_full_ids', $filter->get('_eq_full_ids') . category::FULL_IDS_EQUAL_MATCH_STRING);
     }
     $filter->unsetByName('_eq_full_ids');
     if ($filter->get('_likex_name_or_reference_id')) {
         $names = $filter->get('_likex_name_or_reference_id');
         KalturaLog::debug("Attach free text [{$names}]");
         $additionalConditions = array();
         if (preg_match('/^"[^"]+"$/', $names)) {
             $name = str_replace('"', '', $names);
             $name = SphinxUtils::escapeString($name);
             $name = "^{$name}\$";
             $additionalConditions[] = "@(" . categoryFilter::NAME_REFERNCE_ID . ") {$name}\\\\*";
         } else {
             if (strpos($names, baseObjectFilter::IN_SEPARATOR) > 0) {
                 str_replace(baseObjectFilter::AND_SEPARATOR, baseObjectFilter::IN_SEPARATOR, $names);
                 $namesArr = explode(baseObjectFilter::IN_SEPARATOR, $names);
                 foreach ($namesArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($namesArr[$valIndex]);
                     } else {
                         $namesArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 foreach ($namesArr as $name) {
                     $additionalConditions[] = "@(" . categoryFilter::NAME_REFERNCE_ID . ") {$name}\\\\*";
                 }
             } else {
                 $namesArr = explode(baseObjectFilter::AND_SEPARATOR, $names);
                 foreach ($namesArr as $valIndex => $valValue) {
                     if (!is_numeric($valValue) && strlen($valValue) <= 0) {
                         unset($namesArr[$valIndex]);
                     } else {
                         $namesArr[$valIndex] = SphinxUtils::escapeString($valValue);
                     }
                 }
                 $namesArr = array_unique($namesArr);
                 $nameExpr = implode(baseObjectFilter::AND_SEPARATOR, $namesArr);
                 $additionalConditions[] = "@(" . categoryFilter::NAME_REFERNCE_ID . ") {$nameExpr}\\\\*";
             }
         }
         if (count($additionalConditions)) {
             $additionalConditions = array_unique($additionalConditions);
             $matches = reset($additionalConditions);
             if (count($additionalConditions) > 1) {
                 $matches = '( ' . implode(' ) | ( ', $additionalConditions) . ' )';
             }
             $this->matchClause[] = $matches;
         }
     }
     $filter->unsetByName('_likex_name_or_reference_id');
     return parent::applyFilterFields($filter);
 }
 public function getPositiveMatch($field)
 {
     if ($field == 'roots') {
         return entry::ROOTS_FIELD_PREFIX;
     }
     return parent::getPositiveMatch($field);
 }
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     if ($filter->get('_in_status')) {
         $statusList = explode(',', $filter->get('_in_status'));
         $statusList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::STATUS, $statusList);
         $filter->set('_in_status', implode(',', $statusList));
     }
     if ($filter->get('_eq_status')) {
         $filter->set('_eq_status', categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::STATUS, $filter->get('_eq_status'), kCurrentContext::getCurrentPartnerId()));
     }
     if ($filter->get('_in_update_method')) {
         $updateMethodList = explode(',', $filter->get('_in_update_method'));
         $updateMethodList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::UPDATE_METHOD, $updateMethodList);
         $filter->set('_in_update_method', implode(',', $updateMethodList));
     }
     if ($filter->get('_eq_update_method')) {
         $filter->set('_eq_update_method', categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::UPDATE_METHOD, $filter->get('_eq_update_method'), kCurrentContext::getCurrentPartnerId()));
     }
     if (!is_null($filter->get('_eq_permission_level'))) {
         $permissionLevel = $filter->get('_eq_permission_level');
         $permissionNamesList = categoryKuser::getPermissionNamesByPermissionLevel($permissionLevel);
         $negativePermissionNamesList = $this->fixPermissionNamesListForSphinx($permissionLevel);
         if ($negativePermissionNamesList) {
             $filter->set('_notcontains_permission_names', implode(',', $negativePermissionNamesList));
         }
         if ($filter->get('_matchand_permission_names')) {
             $permissionNamesList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList);
             $criterion = $this->getNewCriterion(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList, baseObjectFilter::MATCH_AND);
             $this->addAnd($criterion);
         } else {
             $filter->set('_matchand_permission_names', $permissionNamesList);
         }
         $filter->unsetByName('_eq_permission_level');
     }
     if ($filter->get('_in_permission_level')) {
         $permissionLevels = $filter->get('_in_permission_level');
         $permissionLevels = explode(',', $permissionLevels);
         foreach ($permissionLevels as $permissionLevel) {
             $permissionNamesList = categoryKuser::getPermissionNamesByPermissionLevel($permissionLevel);
             $permissionNamesList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList);
             $criterion = $this->getNewCriterion(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList, baseObjectFilter::MATCH_AND);
             $this->addOr($criterion);
         }
         $filter->unsetByName('_in_permission_level');
     }
     if ($filter->get('_matchor_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_matchor_permission_names'));
         $permissionNamesList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList);
         $filter->set('_matchor_permission_names', implode(',', $permissionNamesList));
     }
     if ($filter->get('_matchand_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_matchand_permission_names'));
         $permissionNamesList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList);
         $filter->set('_matchand_permission_names', implode(',', $permissionNamesList));
     }
     if ($filter->get('_notcontains_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_notcontains_permission_names'));
         $permissionNamesList = $this->translateToSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionNamesList);
         $filter->set('_notcontains_permission_names', $permissionNamesList);
     }
     if ($filter->get('_eq_category_full_ids')) {
         $filter->set('_eq_category_full_ids', $filter->get('_eq_category_full_ids') . category::FULL_IDS_EQUAL_MATCH_STRING);
     }
     return parent::applyFilterFields($filter);
 }
 protected function applyFilterFields(baseObjectFilter $filter)
 {
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     if ($filter->get('_in_status')) {
         $statusList = explode(',', $filter->get('_in_status'));
         foreach ($statusList as &$status) {
             $status = categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::STATUS, $status, $partnerId);
         }
         $filter->set('_in_status', implode(',', $statusList));
     }
     if ($filter->get('_eq_status')) {
         $filter->set('_eq_status', categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::STATUS, $filter->get('_eq_status'), $partnerId));
     }
     if ($filter->get('_in_update_method')) {
         $updateMethodList = explode(',', $filter->get('_in_update_method'));
         foreach ($updateMethodList as &$updateMethod) {
             $updateMethod = categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::UPDATE_METHOD, $updateMethod, $partnerId);
         }
         $filter->set('_in_update_method', implode(',', $updateMethodList));
     }
     if ($filter->get('_eq_update_method')) {
         $filter->set('_eq_update_method', categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::UPDATE_METHOD, $filter->get('_eq_update_method'), $partnerId));
     }
     if ($filter->get('_matchor_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_matchor_permission_names'));
         foreach ($permissionNamesList as &$permissionName) {
             $permissionName = categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionName, $partnerId);
         }
         $filter->set('_matchor_permission_names', implode(',', $permissionNamesList));
     }
     if ($filter->get('_matchand_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_matchand_permission_names'));
         foreach ($permissionNamesList as &$permissionName) {
             $permissionName = categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionName, $partnerId);
         }
         $filter->set('_matchand_permission_names', implode(',', $permissionNamesList));
     }
     if ($filter->get('_notcontains_permission_names')) {
         $permissionNamesList = explode(',', $filter->get('_notcontains_permission_names'));
         foreach ($permissionNamesList as &$permissionName) {
             $permissionName = categoryKuser::getSearchIndexFieldValue(categoryKuserPeer::PERMISSION_NAMES, $permissionName, $partnerId);
         }
         $filter->set('_notcontains_permission_names', $permissionNamesList);
     }
     if ($filter->get('_eq_category_full_ids')) {
         $filter->set('_eq_category_full_ids', $filter->get('_eq_category_full_ids') . category::FULL_IDS_EQUAL_MATCH_STRING);
     }
     return parent::applyFilterFields($filter);
 }