Hi,
Cusotmer is trying SearchText method to server-based TM.
In some cases, server returns error (sometimes no problem).
Could you please give me some advice?
[Sympton]
- Exception happened on searching Server-based TM on SDL Trados Server 2017.
- Server shows "500 Internal Server Error"
- Exception does not happen on searching file-based TM.
[Question]
- How to search server-based TM from SDL Trados Server 2017 for any characters.
- What is the characters which causes error when searching on SDL Trados Server 2017's server-based TM?
[Expected Result]
"Search Result" is shown with following code and target sentence is shown also if TM has some matches.
[Current Result]
"Exception Raised" is shown and searching text is shown on [Exception Output].
[Code]
using System;
using Sdl.LanguagePlatform.Core;
using Sdl.LanguagePlatform.TranslationMemoryApi;
namespace ConsoleApplication19
{
class Program
{
private const string ServerUri = "http://example.localnet/";
private const string UserName = "********";
private const string Password = "********";
private const string Organization = "TestOrg";
private const string TmName = "TradosSample";
private const string SourceCultureName = "en-US";
private const string TargetCultureName = "de-DE";
static void Main()
{
var provider = new TranslationProviderServer(new Uri(ServerUri), false, UserName, Password);
var memory = provider.GetTranslationMemory($"/{Organization}/{TmName}", TranslationMemoryProperties.All);
var languageDirection = memory.GetLanguageDirection(new LanguagePair(SourceCultureName, TargetCultureName));
try
{
// Exception raised : "100", "1000", "100.0", "-100", "$100", "100%", "100a" etc.
// Exception not raised : "#100", "100b", "100-", etc.
var results = languageDirection.SearchText(new Sdl.LanguagePlatform.TranslationMemory.SearchSettings(), "100");
Console.WriteLine("Search Result");
foreach (var result in results)
{
Console.WriteLine($"{result.ScoringResult.BaseScore} : {result.MemoryTranslationUnit.SourceSegment.ToPlain()} / {result.MemoryTranslationUnit.TargetSegment.ToPlain()}");
}
}
catch (Exception e)
{
Console.WriteLine("Exception Raised");
Console.WriteLine(e);
}
}
}
}
[Exception Output (Locale: ja-JP)]
System.AggregateException: One or more errors occured ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error)。
Location System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Location Sdl.TmService.Sdk.TmServiceRestClient.<TextSearchAsync>d__98.MoveNext()
--- End of inner exception stack trace ---
Location Sdl.TmService.Sdk.TmServiceRestClient.TextSearch(Guid tmId, String sourceLanguage, String targetLanguage, RestTextSearch search)
Location Sdl.LanguagePlatform.TranslationMemoryApi.InternalRestClient.SearchText(LanguageDirectionIdentity languageDirectionId, SearchSettings settings, String segment)
Location Sdl.LanguagePlatform.TranslationMemoryApi.ServerBasedTranslationMemoryLanguageDirection.SearchText(SearchSettings settings, String segment)
Location ConsoleApplication19.Program.Main()
---> (Inner Exception #0) System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error)。
Location System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Location Sdl.TmService.Sdk.TmServiceRestClient.<TextSearchAsync>d__98.MoveNext()<---