Exemplo n.º 1
0
        /// <summary>
        /// Analyzes a parsed SnQuery.
        /// </summary>
        /// <param name="query">The input query object</param>
        /// <returns>An SnQueryInfo instance as a result of the analysis.</returns>
        public static SnQueryInfo Classify(SnQuery query)
        {
            var sortfieldNames = query.Sort?.Select(x => x.FieldName).ToList() ?? new List <string>();
            var queryInfo      = new SnQueryInfo
            {
                Query          = query,
                SortFields     = query.Sort,
                Top            = query.Top,
                Skip           = query.Skip,
                SortFieldNames = sortfieldNames,
                CountAllPages  = query.CountAllPages,
                CountOnly      = query.CountOnly,
                AllVersions    = query.AllVersions
            };

            var visitor = new QueryClassifierVisitor(queryInfo);

            visitor.Visit(query.QueryTree);

            return(queryInfo);
        }
Exemplo n.º 2
0
 public QueryClassifierVisitor(SnQueryInfo queryInfo)
 {
     _queryInfo = queryInfo;
 }