using BaseEntryFilter to search for something not equal to something

1 reply [Last post]
Joined: 02/16/2010
Points: 1

This ought to be easy but I can't find it.

I'm using the Kaltura Client Library with the Kaltura Hosted Edition. My home page displays 9 featured videos, one each from 9 preset categories. I'm using AdminTags to determine whether a video is featured and what categories each video belongs to. A video can belong to multiple categories.

But I want to be sure that if a video is shown as featured for one category on the page, it isn't shown again as featured for another category. Because of other display differences for the categories, and because I need to show them in a particular order, the easiest thing is to use a loop to {select one video for a category, write out the html to display it, and return to the top of the loop, excluding the previously selected video(s) from re-selection}.

Here's my basic code within each loop, without the exclusion of previously selected video(s):

$entryFilter->typeEqual = 1;
$entryFilter->adminTagsMultiLikeAnd = $array['code'] . ",feature";
$entryFilter->statusEqual = KalturaEntryStatus::READY;
$entryFilter->orderBy = KalturaBaseEntryOrderBy::CREATED_AT_DESC;

// use pager to limit to 1 video per category
$kalturaPager = new KalturaFilterPager();
$kalturaPager->pageSize = 1;
$kalturaPager->pageIndex = 1;

$result = $client->baseEntry->listAction($entryFilter, $kalturaPager);

This works fine for what it does.

I would like to use a property that I would define as idNotEqual or idNotIn, but the only properties in the API that I see that allow a Not construct are for Status.

I've tried $entryFilter->idEqual  != "0_38pamvi8"; and even made up a property, just in case it had been left out of the documentation: $entryFilter->idNotEqual  = "0_38pamvi8";, but no joy.

Any one have any ideas? (I'd rather not add laborious code on the display end if I can avoid it; it seems to me this should be something the filter can do.)

Thanks,
Barbara

Joined: 01/05/2009
Points: 1500

Hi Barbara,

If you want something not to show in your selection -
Maybe the way to do it, is to create a different tagging with more unique tags?

For example:
Say we have 4 categories: mammals, cats, dogs and parrots.
And we mark featured videos with adminTag: {category}_featured.
Our videos are:

name:categories:featured?
dolphin:mammals:mammals_featured
cat0:mammals,cats:cats_featured
cat1:mammals,cats
cat2:mammals,cats
cat3:mammals,cats
dog0:mammals,dogs:dogs_featured
dog1:mammals,dogs
dog2:mammals,dogs
dog3:mammals,dogs
parrot1:parrots:parrots_featured
parrot2:parrots
parrot3:parrots

Showcase 4 featured videos (dolphin, cat0, dog0, parrot1), on 4 category pages (mammals, cats, dogs, parrots).
Now instead of filtering according to: $entryFilter->adminTagsMultiLikeAnd = $array['category'] . ",feature";
You would filter according to: $entryFilter->adminTagsMultiLikeAnd = $array['category'] . "_feature";
That will uniquely provide you with selection of a featured video that is specific to the category and not all featured videos with a given category. So when you search for the featured video of mammals, you will only get the dolphin.

This will also not require you to keep track of the ids or filter on the client side, all you have to do is use the KMC to manage the admin tags according to the logic you wish.