SDL Studio 2017 API: GetTranslationMemories() takes ages

Hi

We have upgraded GroupShare to 2017 SR1 and are using the newest SDL Studio 2017 client.

The following code does not work: Credentials are correct, I am using sa user. I can get the ResourceGroups and Resources, but not the TMs.

TranslationProviderServer transProvider = new TranslationProviderServer(new Uri(Host), false, this.Credentials.UserName, this.Credentials.Password);

// it takes ages and nothing happens. The same code when connecting to GroupShare 2014 works as expected.
transProvider.GetTranslationMemories(TranslationMemoryProperties.None);

 

I also tried to get the TMs using a query: But I get an empty Array

TranslationMemoryQuery query = new TranslationMemoryQuery();
query.Properties = TranslationMemoryProperties.None;
query.IsMain = true;
query.IncludeChildResourceGroups = true;
var partTMs = transProvider.GetTranslationMemoriesByQuery(query).TranslationMemories;

Thanks for your help.

best

 

Arben

Parents
  • Hi Arben,

    There does seem to be a problem with the TM API GetTranslationMemories call which we will investigate and fix as soon as possible.

    Studio itself uses the GetTranslationMemoriesByQuery for the GroupShare TM browser dialog. It is designed to be used in a loop. The application sets the TranslationMemoryQuery Index and PageSize properties (e.g. Index = 0 to start from the 1st TM, and PageSize is the number of TMs to return). After each call the Index should be incremented by the page size until no TMs are returned. You could set the PageSize high to return all TMs in one call but this may result in HTTP timeouts depending on the performance of the GroupShare server. Studio uses a page size of 25. The paging of TUs allows the application more control of how the TMs are returned.

    The GetTranslationMemories is a wrapper around GetTranslationMemoriesByQuery and as you have found out, in the latest CU, the Index property does not seem to be incremented correctly.

    Best Regards,

    Iain.
  • Hi Iain

    Thanks for your answer. I already tried to use GetTranslationMemoriesByQuery before making this post. However I am getting an empty array and I know that on our GroupShare instance there are a lot of TMs.

    Am I missing anything?

    Example code:

    TranslationMemoryQuery query = new TranslationMemoryQuery();
    query.IsMain = true;
    query.Size = 500;
    query.IncludeChildResourceGroups = true;
    var page = tmManager2017.TmServer.GetTranslationMemoriesByQuery(query);

    -> page doesn't contain any TMs (independent of the query.Size or of any other query options). The user I am using is the "sa" user, so permissions shouldn't be a problem.

    And here the output from Fiddler:

    /api/tm-service/v1/tms?$count=true&$top=500&$skip=0&$orderby=Name%20asc&$filter=(tolower(OwnerId)%20eq%20'/')%20and%20(not%20Metadata/any()%20or%20Metadata/any(m:%20m/Key%20eq%20'IsProjectTm'%20and%20m/Value%20eq%20'false')%20or%20Metadata/any(m:%20m/Key%20ne%20'IsProjectTm

    What I do not understand is the $filter that is passed with the query. How can I modify this filter options?

    And what does this mean: tolower(OwnerId)%20eq%20'/' 

    -> is OwnerId the ResourceGroupPath? Cause as OwnerId the ResouceGroupPath i passed and in my query it is the Root Oragnization with path "/". 

    If OwnerId is something different then I think a wrong value is passed to the query.

     

    best

     

    arben

  • Hi Arben,

    For getting all TMs, try setting the query.ResourceGroupPath to null or empty string for GroupShare 2017?

    Changing certain TranslationMemoryQuery properties (e.g languages) will change the filter string.

    Best Regards,

    Iain.
Reply Children