Inheritance: INodeQueryCompiler
Exemple #1
0
        public static LucQuery Create(NodeQuery nodeQuery)
        {
            NodeQueryParameter[] parameters;
            var result = new LucQuery();

            SortField[] sortFields;
            string      oldQueryText;

            var compiler          = new SnLucCompiler();
            var compiledQueryText = compiler.Compile(nodeQuery, out parameters);

            sortFields = (from order in nodeQuery.Orders
                          select new SortField(
                              GetFieldNameByPropertyName(order.PropertyName),
                              GetSortType(order.PropertyName),
                              order.Direction == OrderDirection.Desc)).ToArray();

            oldQueryText = compiler.CompiledQuery.ToString();
            oldQueryText = oldQueryText.Replace("[*", "[ ").Replace("*]", " ]").Replace("{*", "{ ").Replace("*}", " }");

            var newQuery = new SnLucParser().Parse(oldQueryText);

            result.Query                = newQuery; // compiler.CompiledQuery,
            result.User                 = nodeQuery.User;
            result.SortFields           = sortFields;
            result.StartIndex           = nodeQuery.Skip;
            result.PageSize             = nodeQuery.PageSize;
            result.Top                  = nodeQuery.Top;
            result.EnableAutofilters    = FilterStatus.Disabled;
            result.EnableLifespanFilter = FilterStatus.Disabled;
            //TODO: QUICK: route through NodeQuery
            result.QueryExecutionMode = QueryExecutionMode.Default;

            return(result);
        }
Exemple #2
0
        public static LucQuery Create(NodeQuery nodeQuery)
        {
            NodeQueryParameter[] parameters;
            var result = new LucQuery();

            result.TraceInfo.BeginCrossCompilingTime();

            SortField[] sortFields;
            string      oldQueryText;

            try
            {
                var compiler          = new SnLucCompiler();
                var compiledQueryText = compiler.Compile(nodeQuery, out parameters);

                sortFields = (from order in nodeQuery.Orders
                              select new SortField(
                                  GetFieldNameByPropertyName(order.PropertyName),
                                  GetSortType(order.PropertyName), //SortField.STRING,
                                  order.Direction == OrderDirection.Desc)).ToArray();

                oldQueryText = compiler.CompiledQuery.ToString();
                oldQueryText = oldQueryText.Replace("[*", "[ ").Replace("*]", " ]").Replace("{*", "{ ").Replace("*}", " }");
                result.TraceInfo.InputText = oldQueryText;
            }
            finally
            {
                result.TraceInfo.FinishCrossCompilingTime();
            }
            result.TraceInfo.BeginParsingTime();
            Query newQuery;

            try
            {
                newQuery = new SnLucParser().Parse(oldQueryText);
            }
            finally
            {
                result.TraceInfo.FinishParsingTime();
            }
            result.Query                = newQuery; // compiler.CompiledQuery,
            result.User                 = nodeQuery.User;
            result.SortFields           = sortFields;
            result.StartIndex           = nodeQuery.Skip;
            result.PageSize             = nodeQuery.PageSize;
            result.Top                  = nodeQuery.Top;
            result.EnableAutofilters    = FilterStatus.Disabled;
            result.EnableLifespanFilter = FilterStatus.Disabled;

            return(result);
        }
Exemple #3
0
        public static LucQuery Create(NodeQuery nodeQuery)
        {
            NodeQueryParameter[] parameters;
            var result = new LucQuery();
            result.TraceInfo.BeginCrossCompilingTime();

            SortField[] sortFields;
            string oldQueryText;
            try
            {
                var compiler = new SnLucCompiler();
                var compiledQueryText = compiler.Compile(nodeQuery, out parameters);

                sortFields = (from order in nodeQuery.Orders
                              select new SortField(
                                  GetFieldNameByPropertyName(order.PropertyName),
                                  GetSortType(order.PropertyName), //SortField.STRING,
                                  order.Direction == OrderDirection.Desc)).ToArray();

                oldQueryText = compiler.CompiledQuery.ToString();
                oldQueryText = oldQueryText.Replace("[*", "[ ").Replace("*]", " ]").Replace("{*", "{ ").Replace("*}", " }");
                result.TraceInfo.InputText = oldQueryText;
            }
            finally
            {
                result.TraceInfo.FinishCrossCompilingTime();
            }
            result.TraceInfo.BeginParsingTime();
            Query newQuery;
            try
            {
                newQuery = new SnLucParser().Parse(oldQueryText);
            }
            finally
            {
                result.TraceInfo.FinishParsingTime();
            }
            result.Query = newQuery; // compiler.CompiledQuery,
            result.User = nodeQuery.User;
            result.SortFields = sortFields;
            result.StartIndex = nodeQuery.Skip;
            result.PageSize = nodeQuery.PageSize;
            result.Top = nodeQuery.Top;
            result.EnableAutofilters = false;
            result.EnableLifespanFilter = false;

            return result;
        }