protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_type", entryType::DATA); $fields_set->set("_eq_status", entryStatus::READY); // make sure will display only $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_in_type", entryType::MEDIA_CLIP); //. "," . entryType::MIX ); if (!$fields_set->get("_order_by")) { $fields_set->set("_order_by", "-created_at"); } }
protected function setExtraFilters(entryFilter &$fields_set) { if (intval($fields_set->get("_in_moderation_status")) == moderation::MODERATION_STATUS_APPROVED) { $fields_set->set("_in_moderation_status", array(moderation::MODERATION_STATUS_APPROVED, moderation::MODERATION_STATUS_AUTO_APPROVED)); } $fields_set->set("_eq_type", entryType::PLAYLIST); $fields_set->set("_eq_status", entryStatus::READY); // make sure will display only $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
function resolveEntryTag(Tag $tag) { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->add(entryPeer::PARTNER_ID, $tag->getPartnerId()); if ($tag->getPrivacyContext() != kTagFlowManager::NULL_PC) { $c->addAnd(entryPeer::PRIVACY_BY_CONTEXTS, $tag->getPrivacyContext(), Criteria::LIKE); } $entryFilter = new entryFilter(); $entryFilter->set('_mlikeand_tags', $tag->getTag()); $entryFilter->attachToCriteria($c); $count = $c->getRecordsCount(); if (!$count) { $tag->delete(); } }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_type", entryType::DVD); $this->setP("use_filter_puser_id", "false"); // don't mind filtering according to the puser/kuser }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_group_id", myPartnerUtils::PARTNER_GROUP); $fields_set->set("_in_type", entryType::MEDIA_CLIP . "," . entryType::MIX); }
private static function executeQueryByType($partner_id, $report_type, $report_flavor, reportsInputFilter $input_filter, $page_size, $page_index, $order_by, $object_ids = null, $offset = null) { $start = microtime(true); try { $add_search_text = false; $has_object_ids = false; if ($input_filter instanceof endUserReportsInputFilter) { $has_object_ids = $input_filter->categories; } $has_object_ids = $has_object_ids || $object_ids; if (is_numeric($report_type)) { $file_path = myReportsSqlFileMgr::getSqlFilePath(self::$type_map[$report_type], self::$flavor_map[$report_flavor], $add_search_text, $has_object_ids ? true : false, $input_filter); } else { if (strpos($report_type, ".") === 0 || strpos($report_type, "/") === 0 || strpos($report_type, "http") === 0) { throw new kCoreException("Will not search for invalid report_type [{$report_type}", kCoreException::INVALID_QUERY); } $file_path = dirname(__FILE__) . "/" . $report_type . ".sql"; } $sql_raw_content = file_get_contents($file_path); if (!$sql_raw_content) { $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaReportProvider'); foreach ($pluginInstances as $pluginInstance) { $res = $pluginInstance->getReportResult($partner_id, $report_type, $report_flavor, $object_ids, $order_by); if (!is_null($res)) { return $res; } } throw new kCoreException("Cannot find sql for [{$report_type}] [{$report_flavor}] at [{$file_path}]", kCoreException::QUERY_NOT_FOUND); } $entryFilter = new entryFilter(); $entryFilter->setPartnerSearchScope($partner_id); $shouldSelectFromSearchEngine = false; $category_ids_clause = "1=1"; if ($input_filter instanceof endUserReportsInputFilter) { if ($input_filter->playbackContext || $input_filter->ancestorPlaybackContext) { $categoryFilter = new categoryFilter(); if ($input_filter->playbackContext && $input_filter->ancestorPlaybackContext) { $categoryIds = category::CATEGORY_ID_THAT_DOES_NOT_EXIST; } else { if ($input_filter->playbackContext) { $categoryFilter->set("_in_full_name", $input_filter->playbackContext); } if ($input_filter->ancestorPlaybackContext) { $categoryFilter->set("_matchor_likex_full_name", $input_filter->ancestorPlaybackContext); } $c = KalturaCriteria::create(categoryPeer::OM_CLASS); $categoryFilter->attachToCriteria($c); $c->applyFilters(); $categoryIdsFromDB = $c->getFetchedIds(); if (count($categoryIdsFromDB)) { $categoryIds = implode(",", $categoryIdsFromDB); } else { $categoryIds = category::CATEGORY_ID_THAT_DOES_NOT_EXIST; } } $category_ids_clause = "ev.context_id in ( {$categoryIds} )"; } } if ($input_filter->categories) { $entryFilter->set("_matchor_categories", $input_filter->categories); $shouldSelectFromSearchEngine = true; } if ($input_filter->keywords) { if ($input_filter->search_in_tags) { $entryFilter->set("_free_text", $input_filter->keywords); } else { $entryFilter->set("_like_admin_tags", $input_filter->keywords); } $shouldSelectFromSearchEngine = true; } $entryIdsFromDB = array(); if ($shouldSelectFromSearchEngine) { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $entryFilter->attachToCriteria($c); $c->applyFilters(); $entryIdsFromDB = $c->getFetchedIds(); if ($c->getRecordsCount() > count($entryIdsFromDB)) { throw new kCoreException('Search is to general', kCoreException::SEARCH_TOO_GENERAL); } if (!count($entryIdsFromDB)) { $entryIdsFromDB[] = entry::ENTRY_ID_THAT_DOES_NOT_EXIST; } } $obj_ids_clause = null; if ($object_ids) { //the object ids are not supposed to include single quotes - if they do have them - remove them $object_ids = str_replace("'", '', $object_ids); // quote all the objects with SINGLE-QUOTES $object_ids_str = "'" . str_replace(",", "','", $object_ids) . "'"; if ($report_type == self::REPORT_TYPE_CONTENT_CONTRIBUTIONS) { $obj_ids_clause = "en.entry_media_source_id in ( {$object_ids_str})"; } else { if ($report_type == self::REPORT_TYPE_TOP_SYNDICATION) { $obj_ids_clause = "ev.domain_id in ( {$object_ids_str})"; } else { if ($report_type == self::REPORT_TYPE_MAP_OVERLAY) { $obj_ids_clause = "ev.country_id in ( {$object_ids_str})"; } else { if ($report_type == self::REPORT_TYPE_ADMIN_CONSOLE) { $obj_ids_clause = "dim_partner.partner_id in ( {$object_ids_str})"; } else { if ($report_type == self::REPORT_TYPE_PARTNER_USAGE || $report_type == self::REPORT_TYPE_VAR_USAGE || $report_type == self::REPORT_TYPE_PEAK_STORAGE) { $obj_ids_clause = "partner_id in ({$object_ids_str})"; } else { if ($report_type == self::REPORT_TYPE_PLATFORMS) { $obj_ids_clause = "device in ({$object_ids_str})"; } else { $objectIds = explode(',', $object_ids); $entryIds = "'" . implode("','", array_merge($objectIds, $entryIdsFromDB)) . "'"; $obj_ids_clause = "ev.entry_id in ( {$entryIds} )"; } } } } } } } elseif (count($entryIdsFromDB)) { $entryIds = "'" . implode("','", $entryIdsFromDB) . "'"; $obj_ids_clause = "ev.entry_id in ( {$entryIds} )"; } if ($input_filter instanceof endUserReportsInputFilter && $input_filter->userIds != null && ($report_type == self::REPORT_TYPE_USER_USAGE || $report_type == self::REPORT_TYPE_SPECIFIC_USER_USAGE)) { $userFilter = new kuserFilter(); $userFilter->set("_in_puser_id", $input_filter->userIds); $c = KalturaCriteria::create(kuserPeer::OM_CLASS); $userFilter->attachToCriteria($c); $c->applyFilters(); $userIdsFromDB = $c->getFetchedIds(); if (count($userIdsFromDB)) { $kuserIds = implode(",", $userIdsFromDB); } else { $kuserIds = kuser::KUSER_ID_THAT_DOES_NOT_EXIST; } $obj_ids_clause = "u.kuser_id in ( {$kuserIds} )"; } if (is_numeric($report_type)) { $order_by = self::getOrderBy(self::$type_map[$report_type], $order_by); } $query = self::getReplacedSql($sql_raw_content, $partner_id, $input_filter, $page_size, $page_index, $order_by, $obj_ids_clause, $category_ids_clause, $offset); if (is_numeric($report_type)) { $query_header = "/* -- " . self::$type_map[$report_type] . " " . self::$flavor_map[$report_flavor] . " -- */\n"; } else { $query_header = "/* -- " . $report_type . " -- */\n"; } KalturaLog::log("\n{$query_header}{$query}"); $res = self::executeQuery($query); $end = microtime(true); KalturaLog::log("Query took [" . ($end - $start) . "]"); return $res; } catch (Exception $ex) { KalturaLog::log($ex->getMessage()); // TODO - write proeper error if ($ex->getCode() == kCoreException::SEARCH_TOO_GENERAL) { } throw $ex; throw new Exception("Error while processing report for [{$partner_id} , {$report_type} , {$report_flavor}]"); } }
/** * List base entries by filter according to reference id * * @action listByReferenceId * @param string $refId Entry Reference ID * @param KalturaFilterPager $pager Pager * @throws KalturaErrors::MISSING_MANDATORY_PARAMETER */ function listByReferenceId($refId, KalturaFilterPager $pager = null) { if (!$refId) { //if refId wasn't provided return an error of missing parameter throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, $refId); } if (!$pager) { $pager = new KalturaFilterPager(); } $entryFilter = new entryFilter(); $entryFilter->setPartnerSearchScope(baseObjectFilter::MATCH_KALTURA_NETWORK_AND_PRIVATE); //setting reference ID $entryFilter->set('_eq_reference_id', $refId); $c = KalturaCriteria::create(entryPeer::OM_CLASS); $pager->attachToCriteria($c); $entryFilter->attachToCriteria($c); $c->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); KalturaCriterion::disableTag(KalturaCriterion::TAG_WIDGET_SESSION); $list = entryPeer::doSelect($c); KalturaCriterion::restoreTag(KalturaCriterion::TAG_WIDGET_SESSION); $totalCount = $c->getRecordsCount(); $newList = KalturaBaseEntryArray::fromEntryArray($list, false); $response = new KalturaBaseEntryListResponse(); $response->objects = $newList; $response->totalCount = $totalCount; return $response; }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_user_id", $this->puser_id); $fields_set->set("_eq_type", entryType::DVD); }
/** * @param Tag $tag * @return int */ private function resolveEntryTag(Tag $tag) { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->add(entryPeer::PARTNER_ID, $tag->getPartnerId()); if ($tag->getPrivacyContext() != kTagFlowManager::NULL_PC) { $c->addAnd(entryPeer::PRIVACY_BY_CONTEXTS, $tag->getPrivacyContext(), Criteria::LIKE); } $entryFilter = new entryFilter(); $tagString = str_replace(kTagFlowManager::$specialCharacters, kTagFlowManager::$specialCharactersReplacement, $tag->getTag()); $entryFilter->set('_mlikeand_tags', $tagString); $entryFilter->attachToCriteria($c); $c->applyFilters(); $count = $c->getRecordsCount(); if (!$count) { $tag->delete(); return 1; } else { $tag->setInstanceCount($count); $tag->save(); return 1; } return 0; }
/** * @action getFeed * @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY * @param int $distributionProfileId * @param string $hash * @param int $page * @param int $period * @param string $state * @param bool $ignoreScheduling * @return file */ public function getFeedAction($distributionProfileId, $hash, $page = 1, $period = -1, $state = '', $ignoreScheduling = false) { if (!$this->getPartnerId() || !$this->getPartner()) { throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $this->getPartnerId()); } $profile = DistributionProfilePeer::retrieveByPK($distributionProfileId); /* @var $profile DoubleClickDistributionProfile */ if (!$profile || !$profile instanceof DoubleClickDistributionProfile) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_NOT_FOUND, $distributionProfileId); } if ($profile->getStatus() != KalturaDistributionProfileStatus::ENABLED) { throw new KalturaAPIException(ContentDistributionErrors::DISTRIBUTION_PROFILE_DISABLED, $distributionProfileId); } if ($profile->getUniqueHashForFeedUrl() != $hash) { throw new KalturaAPIException(DoubleClickDistributionErrors::INVALID_FEED_URL); } if (!$page || $page < 1) { $page = 1; } $stateLastEntryCreatedAt = null; $stateLastEntryIds = array(); if ($state) { $stateDecoded = base64_decode($state); if (strpos($stateDecoded, '|') !== false) { $stateExploded = explode('|', $stateDecoded); $stateLastEntryCreatedAt = $stateExploded[0]; $stateLastEntryIdsStr = $stateExploded[1]; $stateLastEntryIds = explode(',', $stateLastEntryIdsStr); } } // "Creates advanced filter on distribution profile $distributionAdvancedSearch = new ContentDistributionSearchFilter(); $distributionAdvancedSearch->setDistributionProfileId($profile->getId()); if ($ignoreScheduling !== true && $profile->getIgnoreSchedulingInFeed() !== true) { $distributionAdvancedSearch->setDistributionSunStatus(EntryDistributionSunStatus::AFTER_SUNRISE); } $distributionAdvancedSearch->setEntryDistributionStatus(EntryDistributionStatus::READY); $distributionAdvancedSearch->setEntryDistributionFlag(EntryDistributionDirtyStatus::NONE); $distributionAdvancedSearch->setHasEntryDistributionValidationErrors(false); // Creates entry filter with advanced filter $entryFilter = new entryFilter(); $entryFilter->setStatusEquel(entryStatus::READY); $entryFilter->setModerationStatusNot(entry::ENTRY_MODERATION_STATUS_REJECTED); $entryFilter->setPartnerSearchScope($this->getPartnerId()); $entryFilter->setAdvancedSearch($distributionAdvancedSearch); $entryFilter->set('_order_by', '-created_at'); if ($period && $period > 0) { $entryFilter->set('_gte_updated_at', time() - 24 * 60 * 60); } // last 24 hours // Dummy query to get the total count $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); $baseCriteria->setLimit(1); $entryFilter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $totalCount = $baseCriteria->getRecordsCount(); // Add the state data to proceed to next page if ($stateLastEntryCreatedAt) { $entryFilter->set('_lte_created_at', $stateLastEntryCreatedAt); } if ($stateLastEntryIds) { $entryFilter->set('_notin_id', $stateLastEntryIds); } $baseCriteria = KalturaCriteria::create(entryPeer::OM_CLASS); $baseCriteria->add(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM, Criteria::NOT_EQUAL); $baseCriteria->setLimit($profile->getItemsPerPage() + 1); // get +1 to check if we have next page $entryFilter->attachToCriteria($baseCriteria); $entries = entryPeer::doSelect($baseCriteria); $hasNextPage = false; if (count($entries) === $profile->getItemsPerPage() + 1) { // we tried to get (itemsPerPage + 1) entries, meaning we have another page $hasNextPage = true; unset($entries[$profile->getItemsPerPage()]); } // Find the state $entryIds = array(); $nextPageStateLastEntryCreatedAt = $stateLastEntryCreatedAt; $nextPageStateLastEntryIds = $stateLastEntryIds; foreach ($entries as $entry) { $entryIds[] = $entry->getId(); if ($nextPageStateLastEntryCreatedAt > $entry->getCreatedAt(null)) { $nextPageStateLastEntryIds = array(); } $nextPageStateLastEntryIds[] = $entry->getId(); $nextPageStateLastEntryCreatedAt = $entry->getCreatedAt(null); } // Construct the feed $feed = new DoubleClickFeed('doubleclick_template.xml', $profile); $feed->setTotalResult($totalCount); $feed->setStartIndex(($page - 1) * $profile->getItemsPerPage() + 1); $feed->setSelfLink($this->getUrl($distributionProfileId, $hash, $page, $period, $stateLastEntryCreatedAt, $stateLastEntryIds)); if ($hasNextPage) { $feed->setNextLink($this->getUrl($distributionProfileId, $hash, $page + 1, $period, $nextPageStateLastEntryCreatedAt, $nextPageStateLastEntryIds)); } $profileUpdatedAt = $profile->getUpdatedAt(null); $cacheDir = kConf::get("global_cache_dir") . "feeds/dist_{$distributionProfileId}/"; foreach ($entries as $entry) { // check cache $cacheFileName = $cacheDir . myContentStorage::dirForId($entry->getIntId(), $entry->getId() . ".xml"); $updatedAt = max($profileUpdatedAt, $entry->getUpdatedAt(null)); if (file_exists($cacheFileName) && $updatedAt < filemtime($cacheFileName)) { $xml = file_get_contents($cacheFileName); } else { /* @var $entry entry */ $entryDistribution = EntryDistributionPeer::retrieveByEntryAndProfileId($entry->getId(), $profile->getId()); if (!$entryDistribution) { KalturaLog::err('Entry distribution was not found for entry [' . $entry->getId() . '] and profile [' . $profile->getId() . ']'); continue; } $fields = $profile->getAllFieldValues($entryDistribution); $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds())); $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds())); $cuePoints = $this->getCuePoints($entry->getPartnerId(), $entry->getId()); $xml = $feed->getItemXml($fields, $flavorAssets, $thumbAssets, $cuePoints); mkdir(dirname($cacheFileName), 0777, true); file_put_contents($cacheFileName, $xml); } $feed->addItemXml($xml); } header('Content-Type: text/xml'); echo $feed->getXml(); die; }
protected function setExtraFilters(entryFilter &$fields_set) { $fields_set->set("_eq_user_id", $this->puser_id); $fields_set->set("_in_type", entryType::MEDIA_CLIP . "," . entryType::MIX); }
/** * Removes the category from the entries */ private function removeFromEntries() { $c = KalturaCriteria::create(entryPeer::OM_CLASS); $entryFilter = new entryFilter(); $entryFilter->set("_matchor_categories_ids", $this->getId()); $entryFilter->attachToCriteria($c); $entries = entryPeer::doSelect($c); foreach ($entries as $entry) { $entry->removeCategory($this->full_name); $entry->syncCategories(); } }
/** * Applies all filter fields and unset the handled fields * * @param baseObjectFilter $filter */ protected function applyFilterFields(entryFilter $filter) { if ($filter->get("_matchand_categories") !== null) { $filter->set("_matchand_categories_ids", $filter->categoryNamesToIds($filter->get("_matchand_categories"))); $filter->unsetByName('_matchand_categories'); } if ($filter->get("_matchor_categories") !== null) { $filter->set("_matchor_categories_ids", $filter->categoryNamesToIds($filter->get("_matchor_categories"))); $filter->unsetByName('_matchor_categories'); } if ($filter->get("_matchor_duration_type") !== null) { $filter->set("_matchor_duration_type", $filter->durationTypesToIndexedStrings($filter->get("_matchor_duration_type"))); } if ($filter->get(baseObjectFilter::ORDER) === "recent") { $filter->set("_lte_available_from", time()); $filter->set("_gteornull_end_date", time()); // schedule not finished $filter->set(baseObjectFilter::ORDER, "-available_from"); } if ($filter->get('_free_text')) { KalturaLog::debug('No advanced filter defined'); $freeTexts = $filter->get('_free_text'); $additionalConditions = array(); if (preg_match('/^"[^"]+"$/', $freeTexts)) { $additionalConditions[] = $freeText; // fixme - only name,tags,description ? } 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) <= 1) { unset($freeTextsArr[$valIndex]); } } foreach ($freeTextsArr as $freeText) { $additionalConditions[] = $freeText; // fixme - only name,tags,description ? } } else { $freeTextsArr = explode(baseObjectFilter::AND_SEPARATOR, $freeTexts); foreach ($freeTextsArr as $valIndex => $valValue) { if (!is_numeric($valValue) && strlen($valValue) <= 1) { unset($freeTextsArr[$valIndex]); } } $freeTextExpr = implode(" +", $freeTextsArr); $additionalConditions[] = $freeTextExpr; // fixme - only name,tags,description ? } } if (count($additionalConditions)) { $this->whereClause[] = '(' . implode(' ', $additionalConditions) . ')'; } } $filter->unsetByName('_free_text'); foreach ($filter->fields as $field => $val) { if (is_null($val) || !strlen($val)) { // KalturaLog::debug("Skip field[$field] value is null"); continue; } $fieldParts = explode(baseObjectFilter::FILTER_PREFIX, $field, 3); if (count($fieldParts) != 3) { KalturaLog::debug("Skip field[{$field}] has [" . count($fieldParts) . "] parts"); continue; } list($prefix, $operator, $fieldName) = $fieldParts; $fieldNamesArr = explode(baseObjectFilter::OR_SEPARATOR, $fieldName); if (count($fieldNamesArr) > 1) { $solrFieldNames = array(); foreach ($fieldNamesArr as $fieldName) { $solrField = self::getSolrFieldName($fieldName); $type = self::getSolrFieldType($solrField); $solrFieldNames[] = $solrField; } $solrField = '(' . implode(',', $solrFieldNames) . ')'; $vals = array_unique(explode(baseObjectFilter::OR_SEPARATOR, $val)); $val = implode(' ', $vals); } elseif (!$this->hasMatchableField($fieldName)) { KalturaLog::debug("Skip field[{$field}] has no matchable for name[{$fieldName}]"); continue; } else { $solrField = self::getSolrFieldName($fieldName); $type = self::getSolrFieldType($solrField); } $valStr = print_r($val, true); KalturaLog::debug("Attach field[{$fieldName}] as solr field[{$solrField}] of type [{$type}] and comparison[{$operator}] for value[{$valStr}]"); switch ($operator) { case baseObjectFilter::MULTI_LIKE_OR: case baseObjectFilter::MATCH_OR: $vals = explode(',', $val); foreach ($vals as $valIndex => $valValue) { if (!is_numeric($valValue) && strlen($valValue) <= 1) { unset($vals[$valIndex]); } } if (count($vals)) { $this->whereClause[] = "{$solrField}:(" . implode(" ", $vals) . ")"; $filter->unsetByName($field); } break; case baseObjectFilter::NOT_IN: $vals = array(); if (is_string($val)) { $vals = explode(',', $val); } elseif (is_array($val)) { $vals = $val; } foreach ($vals as $valIndex => $valValue) { if (!is_numeric($valValue) && strlen($valValue) <= 1) { unset($vals[$valIndex]); } } if (count($vals)) { $vals = array_slice($vals, 0, self::MAX_IN_VALUES); $this->whereClause[] = "-{$solrField}:(" . implode(" ", $vals) . ")"; $filter->unsetByName($field); } break; case baseObjectFilter::IN: $vals = array(); if (is_string($val)) { $vals = explode(',', $val); } elseif (is_array($val)) { $vals = $val; } foreach ($vals as $valIndex => $valValue) { if (!is_numeric($valValue) && strlen($valValue) <= 1) { unset($vals[$valIndex]); } } if (count($vals)) { $vals = array_slice($vals, 0, self::MAX_IN_VALUES); $this->whereClause[] = "{$solrField}:(" . implode(" ", $vals) . ")"; $filter->unsetByName($field); } break; case baseObjectFilter::EQ: if (is_numeric($val) || strlen($val) > 1) { $this->whereClause[] = "{$solrField}:{$val}"; // fixme - find exact match $filter->unsetByName($field); } break; case baseObjectFilter::MULTI_LIKE_AND: case baseObjectFilter::MATCH_AND: case baseObjectFilter::LIKE: $vals = explode(',', $val); foreach ($vals as $valIndex => $valValue) { if (!is_numeric($valValue) && strlen($valValue) <= 1) { unset($vals[$valIndex]); } } if (count($vals)) { $this->whereClause[] = "{$solrField}:(+" . implode(" +", $vals) . ")"; $filter->unsetByName($field); } break; default: KalturaLog::debug("Skip field[{$field}] has no opertaor[{$operator}]"); } } }