public function applyCondition(IKalturaDbQuery $query) { if (is_null($this->categoriesMatchOr) && is_null($this->categoryIdEqual)) { return; } // Fetch the list of categories $categoryEntries = null; if ($this->categoriesMatchOr) { $categoryEntries = entryFilter::categoryFullNamesToIdsParsed($this->categoriesMatchOr, $this->categoryEntryStatusIn); } else { $categoryEntries = entryFilter::categoryIdsToSphinxIds($this->categoryIdEqual, $this->categoryEntryStatusIn); } if ($categoryEntries == '') { // Set a non-exiting cat. id. in order to return empty results (instead of throwing an exception) $categoryEntries = category::CATEGORY_ID_THAT_DOES_NOT_EXIST; } $categoryEntries = explode(',', $categoryEntries); if ($query instanceof IKalturaIndexQuery) { $categoriesStrs = array(); foreach ($categoryEntries as $categoryId) { $categoriesStrs[] = '"' . $categoryId . '"'; } $query->addMatch('@' . entryIndex::getIndexFieldName(entryPeer::CATEGORIES_IDS) . ' (' . implode(' | ', $categoriesStrs) . ')'); } else { $query->addColumnWhere(entryPeer::CATEGORIES_IDS, $categoryEntries, KalturaCriteria::IN_LIKE); } if ($this->orderBy) { $orderByField = substr($this->orderBy, 1); $orderBy = $this->orderBy[0] == '+' ? Criteria::ASC : Criteria::DESC; if ($orderByField != self::CREATED_AT) { throw new kCoreException("Unsupported orderBy criteria [{$orderByField}]"); } $dynAttribCriteriaFieldName = entryIndex::DYNAMIC_ATTRIBUTES . '.' . self::getCategoryCreatedAtDynamicAttributeName($this->categoryIdEqual); $query->addNumericOrderBy($dynAttribCriteriaFieldName, $orderBy); } }
public static function getApiMatchAttributesMap() { if (!self::$apiMatchAttributesMap) { self::$apiMatchAttributesMap = array('id' => 'entry_id', 'name' => 'name', 'tags' => 'tags', 'categoriesIds' => 'categories', 'flavorParamsIds' => 'flavor_params', 'groupId' => 'group_id', 'description' => 'description', 'adminTags' => 'admin_tags', 'durationType' => 'duration_type', 'referenceId' => 'reference_id', 'replacingEntryId' => 'replacing_entry_id', 'replacedEntryId' => 'replaced_entry_id', 'userId' => 'puser_id', 'creatorId' => 'creator_puser_id', 'searchText' => '(name,tags,description,entry_id,reference_id,roots,puser_id)'); } return self::$apiMatchAttributesMap; }
public static function getSphinxConditionsToKeep() { if (!self::$conditionToKeep) { self::$conditionToKeep = array('entry.PARTNER_ID'); } return self::$conditionToKeep; }