Best way to lauch concordance on many TMs

Dear community members,

I am developing an API which is launching a concordance search (searchtext) on many TMs. Currently, I am looping through a collection of TMs and launch the search function for each TM individually.

I was wondering if there is a possibility to launch the search function once on the whole collection of TMs directly. Can the searchtext function be applied to a collection of TMs or does it apply to a single TM only?

Thanks in advance for your advices.

regards,

 

Laurent

Parents
  • Here is what I am doing.  I don't yet see a way to execute the SearchText function on multiple TMs because it belongs to the ITranslationMemoryLanguageDirection interface.  I believe SearchText only applies to a single TM.

    /// <summary>

           /// See producthelp.sdl.com/.../Index.aspx

           /// search for "concordance" and select "Doing Translation Memory Lookups" section

           ///

           /// Also see producthelp.sdl.com/.../Index.aspx

           /// search for "concordance" and select "Implementing the Search Functionality" section

           ///

           /// see producthelp.sdl.com/.../Index.aspx

           /// "Working with File-Based-Translation-Memories"

           /// </summary>

           /// <param name="phrase"></param>

           internal void DoCondordanceSearch(Phrase phrase)

           {

               TranslationProviderConfiguration translationProviderConfiguration =

                   _projectsController.CurrentProject.GetTranslationProviderConfiguration();

               foreach (TranslationProviderCascadeEntry entry in translationProviderConfiguration.Entries)

               {

                   if (entry.PerformConcordanceSearch)

                   {

                       var tm = new FileBasedTranslationMemory(entry.MainTranslationProvider.Uri);

                       if (tm.SupportsConcordanceSearch)

                       {

                           SearchResults results =

                               tm.LanguageDirection.SearchText(this.GetSearchSettings(SearchMode.ConcordanceSearch), phrase.ToString());

                           string hitList = "Hit count: " + results.Count.ToString() + "\n\n";

                           foreach (SearchResult result in results)

                           {

                               hitList += GetTuInformation(result);

                           }

                           MessageBox.Show(hitList);

                       }

                   }

               }

           }

Reply
  • Here is what I am doing.  I don't yet see a way to execute the SearchText function on multiple TMs because it belongs to the ITranslationMemoryLanguageDirection interface.  I believe SearchText only applies to a single TM.

    /// <summary>

           /// See producthelp.sdl.com/.../Index.aspx

           /// search for "concordance" and select "Doing Translation Memory Lookups" section

           ///

           /// Also see producthelp.sdl.com/.../Index.aspx

           /// search for "concordance" and select "Implementing the Search Functionality" section

           ///

           /// see producthelp.sdl.com/.../Index.aspx

           /// "Working with File-Based-Translation-Memories"

           /// </summary>

           /// <param name="phrase"></param>

           internal void DoCondordanceSearch(Phrase phrase)

           {

               TranslationProviderConfiguration translationProviderConfiguration =

                   _projectsController.CurrentProject.GetTranslationProviderConfiguration();

               foreach (TranslationProviderCascadeEntry entry in translationProviderConfiguration.Entries)

               {

                   if (entry.PerformConcordanceSearch)

                   {

                       var tm = new FileBasedTranslationMemory(entry.MainTranslationProvider.Uri);

                       if (tm.SupportsConcordanceSearch)

                       {

                           SearchResults results =

                               tm.LanguageDirection.SearchText(this.GetSearchSettings(SearchMode.ConcordanceSearch), phrase.ToString());

                           string hitList = "Hit count: " + results.Count.ToString() + "\n\n";

                           foreach (SearchResult result in results)

                           {

                               hitList += GetTuInformation(result);

                           }

                           MessageBox.Show(hitList);

                       }

                   }

               }

           }

Children