Sorting videos by metadata

Hi to Everybody,

I’m needing to filter and order my video entries by metadata. By the moment I can filter my video entries, but I can’t order (sort) these. I have created a new date field into the metadata, and I want order my video entries by this.

I was trying do it from Kaltura Test Console. The steps I followed are:

  1. Login to get Kaltura Session.
  2. Select service “media” and then action “list”
  3. Select “KalturaMediaEntryFilder” into Filter field.
  4. From KalturaMediaEntryFilter tab:
    —1) Select “KalturaMetadataSearchItem” into AdvanceSearch field.
    —2) From KalturaMetadataSearchItem tab:
    ------1) Set Metadata Profile Id.
    ------2) Put +/[local-name()=‘metadata’]/[local-name()=‘Test’] into orderBy field. Test is the field witch I want order the video entries.
    ------3) Add a new item and then select “KalturaSearchCondition” into the new field.
    ------4) From new KalturaSearchCondition tab:
    ------------1) Put /[local-name()=‘metadata’]/[local-name()=‘Test’] into Field field for filter these entries that have the Test field on his metadata.

So, when I click the “Send” button it returns me all video entries that have the “Test” metadata field, but these aren’t sorted.

Can anyone help me?
Thanks in advance!!!

You need to use orderBy field with one of these:
const CREATED_AT_ASC = “+createdAt”;
const DURATION_ASC = “+duration”;
const END_DATE_ASC = “+endDate”;
const LAST_PLAYED_AT_ASC = “+lastPlayedAt”;
const MODERATION_COUNT_ASC = “+moderationCount”;
const NAME_ASC = “+name”;
const PARTNER_SORT_VALUE_ASC = “+partnerSortValue”;
const PLAYS_ASC = “+plays”;
const RANK_ASC = “+rank”;
const RECENT_ASC = “+recent”;
const START_DATE_ASC = “+startDate”;
const TOTAL_RANK_ASC = “+totalRank”;
const UPDATED_AT_ASC = “+updatedAt”;
const VIEWS_ASC = “+views”;
const CREATED_AT_DESC = “-createdAt”;
const DURATION_DESC = “-duration”;
const END_DATE_DESC = “-endDate”;
const LAST_PLAYED_AT_DESC = “-lastPlayedAt”;
const NAME_DESC = “-name”;
const PLAYS_DESC = “-plays”;
const RANK_DESC = “-rank”;
const RECENT_DESC = “-recent”;
const START_DATE_DESC = “-startDate”;
const TOTAL_RANK_DESC = “-totalRank”;
const UPDATED_AT_DESC = “-updatedAt”;
const VIEWS_DESC = “-views”;

Note that the above are options for ordering entries.
For order metadata specifically, you have:

-------const CREATED_AT_ASC = “+createdAt”;
-------const METADATA_PROFILE_VERSION_ASC = “+metadataProfileVersion”;
-------const UPDATED_AT_ASC = “+updatedAt”;
-------const VERSION_ASC = “+version”;
-------const CREATED_AT_DESC = “-createdAt”;
-------const METADATA_PROFILE_VERSION_DESC = “-metadataProfileVersion”;
-------const UPDATED_AT_DESC = “-updatedAt”;
-------const VERSION_DESC = “-version”;

So is it means we can’t sort by custom properties? For example, CommentsCount.