Ejemplo n.º 1
0
        private TermIndex _Index2; // Index on second language

        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="termbaseSet"></param>
        /// <returns></returns>
        /// <created>UPh,25.10.2015</created>
        /// <changed>UPh,25.10.2015</changed>
        // ********************************************************************************
        internal TermBaseQueryWorker(TermBaseQuery termbaseQuery, TermBases termbases)
        {
            _TermbaseQuery = termbaseQuery;
            _TermBases     = termbases;
            _Index         = new TermIndex();
            _Index2        = new TermIndex();
        }
Ejemplo n.º 2
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="requestid"></param>
        /// <param name="match"></param>
        /// <param name="from"></param>
        /// <param name="len"></param>
        /// <param name="result"></param>
        /// <created>UPh,20.03.2016</created>
        /// <changed>UPh,20.03.2016</changed>
        // ********************************************************************************
        private void HandleProhibitedTerminologyMatch(bool bTargetLanguage, long requestid, IndexItem match, int from, int len, List <TerminologyResultArgs> result = null)
        {
            // Get TermInfo
            TermBase termbase = _TermBases.FindTermBase(match.TermBaseID);

            if (termbase == null)
            {
                return;
            }

            TermInfo terminfo = null;

            if (!termbase.GetTermInfo(match.TermID, out terminfo, this))
            {
                return;
            }

            int langset = -1;

            if (bTargetLanguage)
            {
                if (terminfo.LanguageSets.Count < 2)
                {
                    return;
                }
                langset = 1;
            }
            else
            {
                if (terminfo.LanguageSets.Count < 1)
                {
                    return;
                }
                langset = 0;
            }


            foreach (TermInfo.Term term in terminfo.LanguageSets[langset].Terms)
            {
                if (term.Props == null || term.Props.Status != TermStatus.prohibited)
                {
                    continue;
                }

                ulong hash = TermIndex.MakeGlossaryHashCode(term.Text);
                if (match.Hash != hash)
                {
                    continue;
                }

                TerminologyResultArgs args = new TerminologyResultArgs();

                args.Status      = term.Props.Status;
                args.RequestID   = requestid;
                args.TermBaseID  = match.TermBaseID;
                args.TermID      = match.TermID;
                args.FindFrom    = from;
                args.FindLen     = len;
                args.Term1       = term.Text;
                args.Term2       = term.Text;
                args.Origin      = termbase.File.DisplayName;
                args.Description = "";

                if (result != null)
                {
                    result.Add(args);
                }
                else
                {
                    _TermbaseQuery.FireTerminologyResult(args);
                }
            }
        }
Ejemplo n.º 3
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="match"></param>
        /// <returns></returns>
        /// <created>UPh,14.11.2015</created>
        /// <changed>UPh,14.11.2015</changed>
        // ********************************************************************************
        private void HandleTerminologyMatch(long requestid, IndexItem match, int from, int len, List <TerminologyResultArgs> result = null)
        {
            // Get TermInfo
            TermBase termbase = _TermBases.FindTermBase(match.TermBaseID);

            if (termbase == null)
            {
                return;
            }

            TermInfo terminfo = null;

            if (!termbase.GetTermInfo(match.TermID, out terminfo, this))
            {
                return;
            }

            if (terminfo.LanguageSets.Count != 2)
            {
                return;
            }

            TermInfo.Term srcterm = null;

            foreach (TermInfo.Term term in terminfo.LanguageSets[0].Terms)
            {
                ulong hash = TermIndex.MakeGlossaryHashCode(term.Text);
                if (match.Hash != hash)
                {
                    continue;
                }

                srcterm = term;
                break;
            }

            if (srcterm == null)
            {
                return;
            }

            string definition = terminfo.Definition;


            foreach (TermInfo.Term term in terminfo.LanguageSets[1].Terms)
            {
                TerminologyResultArgs args = new TerminologyResultArgs();

                if (term.Props != null)
                {
                    args.Status = term.Props.Status;
                }
                else
                {
                    args.Status = TermStatus.none;
                }
                args.RequestID   = requestid;
                args.TermBaseID  = match.TermBaseID;
                args.TermID      = match.TermID;
                args.FindFrom    = from;
                args.FindLen     = len;
                args.Term1       = srcterm.Text;
                args.Term2       = term.Text;
                args.Origin      = termbase.File.DisplayName;
                args.Description = definition;

                if (result != null)
                {
                    result.Add(args);
                }
                else
                {
                    _TermbaseQuery.FireTerminologyResult(args);
                }
            }
        }