상속: IExpression
예제 #1
0
        /// <summary>
        /// Parse a single piece of the entire search query into an Expression form using corrector
        /// </summary>
        /// <param name="term">A truncated piece contains no delimiters</param>
        /// <param name="corrector">Corrector to be used to add suggestions to the expression</param>
        /// <returns>IExpression contains the original term and the suggestions of the word</returns>
        private static IExpression ParseTerm(string term, ITermCorrector corrector)
        {
            IExpression result = new TermExpression(term);

            if (corrector != null)
            {
                foreach (string correction in corrector.Correct(term))
                {
                    if (correction != term)
                    {
                        IExpression expr = new TermExpression(correction);
                        result = LogicOrExpression.Join(result, expr);
                    }
                }
            }
            return(result);
        }
예제 #2
0
 /// <summary>
 /// Parse a single piece of the entire search query into an Expression form using corrector
 /// </summary>
 /// <param name="term">A truncated piece contains no delimiters</param>
 /// <param name="corrector">Corrector to be used to add suggestions to the expression</param>
 /// <returns>IExpression contains the original term and the suggestions of the word</returns>
 private static IExpression ParseTerm(string term, ITermCorrector corrector)
 {
     IExpression result=null;
     if (term.Length >= 2)
     {
         result = new TermExpression(term);
     }
     if (corrector != null)
     {
         foreach (string correction in corrector.Correct(term))
         {
             IExpression expr = new TermExpression(correction);
             result = LogicOrExpression.Join(result, expr);
         }
     }
     return result;
 }