MetadataListService - must filter on object iD


#1

Hello all,

I just upgraded to 14.10 and some of my code in a client application (c#) is throwing an exception. I am trying to list metadata and I get an exception that I must filter by objectid.

This wasn’t a problem before the upgrade, so I’m trying to figure out what might have changed…

Here is a code snippet

Client client;
        client = InitClient();
        client.ClientTag = "CacheMetadata";
        MetadataFilter metafilter = new MetadataFilter();
        FilterPager pager = new FilterPager();
        pager.PageSize = 500;
        bool done = false;
        List<Metadata> resultsTemp = new List<Metadata>();
        List<Metadata> results = new List<Metadata>();
        int metadataCount = 0;
        
        OnCompletedHandler<ListResponse<Metadata>> metahandler = new OnCompletedHandler<ListResponse<Metadata>>(
        (ListResponse<Metadata> result, Exception e) =>
        {
            metadataCount = result.TotalCount;
            resultsTemp = (List<Metadata>)result.Objects;
            done = true;

        });   

        metafilter.MetadataObjectTypeEqual = MetadataObjectType.ENTRY;
        metafilter.StatusEqual = MetadataStatus.VALID;
        metafilter.MetadataProfileIdEqual = _kalturaMetadataProfileID;
        MetadataListRequestBuilder metarequest = new MetadataListRequestBuilder(metafilter,pager);
        metarequest.SetCompletion(metahandler);
        Logging.DebugTrace("Calling client execute for metadata.", EventIDs.KalturaAPICall, System.Diagnostics.TraceEventType.Information);
        metarequest.Execute(client);

        while (!done) { Thread.Sleep(1); };
        done = false;

        Logging.DebugTrace("Retrieved metadata count from Kaltura. " + metadataCount.ToString() + " metadata items exist", EventIDs.KalturaAPICall, System.Diagnostics.TraceEventType.Information);

I’ve tried updating my client library, but I think there is a bug in the latest C# library that prevent compiling. I can post about that later.

Thanks for any help


#2

So, studying some recent commits to the code base, it seems some configuration option was added that may or may not be related here. It is named “metadata_list_without_object_filtering_partners”.

Studying the code, it seems I may be able to set a parameter for partners that would allow metadata listing without filtering by objectID. I’m now looking for where this parameter might be set. Any ideas @jess ?

Referencing this commit specifically. https://github.com/kaltura/server/pull/6269/commits/299575af596678c69133ab9128c53f6dfab871d7


#3

In case someone else runs into this.

If you find that the MedataListService is requiring and objectid filter and you want to actually use the service to get a list of metadata objects, here is what you need to do.

Add a section to the end your local.ini file on each front end server that is similar to this:

[metadata_list_without_object_filtering_partners]
103 = 1

Where 103 is the partner that will be allowed to query without an objectID parameter. 1 signifies that they can query objects of type ENTRY.

This will likely be wiped out when you do an upgrade of your on-prem CE, so you’ll have to remember to replace it.

If you don’t want to specify a type, you can leave the second line of my example like:

103 = 

Again, where 103 is your publisher.

If you have multiple publishers, just add more lines in that section. If you have multiple types, separate them with a comma.