Example #1
0
        private DocumentQuery <TResult> CreateDocumentQueryInternal <TResult>(QueryData queryData = null)
        {
            var newFieldsToFetch = queryData != null && queryData.Fileds.Length > 0
                ? FieldsToFetchToken.Create(queryData.Fileds, queryData.Projections.ToArray(), queryData.IsCustomFunction)
                : null;

            if (newFieldsToFetch != null)
            {
                UpdateFieldsToFetchToken(newFieldsToFetch);
            }

            var query = new DocumentQuery <TResult>(
                TheSession,
                IndexName,
                CollectionName,
                IsGroupBy,
                queryData?.DeclareToken,
                queryData?.LoadTokens,
                queryData?.FromAlias)
            {
                QueryRaw           = QueryRaw,
                PageSize           = PageSize,
                SelectTokens       = SelectTokens,
                FieldsToFetchToken = FieldsToFetchToken,
                WhereTokens        = WhereTokens,
                OrderByTokens      = OrderByTokens,
                GroupByTokens      = GroupByTokens,
                QueryParameters    = QueryParameters,
                Start      = Start,
                Timeout    = Timeout,
                CutoffEtag = CutoffEtag,
                QueryStats = QueryStats,
                TheWaitForNonStaleResults = TheWaitForNonStaleResults,
                Negate    = Negate,
                Includes  = new HashSet <string>(Includes),
                RootTypes = { typeof(T) },
                BeforeQueryExecutedCallback = BeforeQueryExecutedCallback,
                AfterQueryExecutedCallback  = AfterQueryExecutedCallback,
                AfterStreamExecutedCallback = AfterStreamExecutedCallback,
                HighlightedFields           = new List <HighlightedField>(HighlightedFields),
                HighlighterPreTags          = HighlighterPreTags,
                HighlighterPostTags         = HighlighterPostTags,
                DisableEntitiesTracking     = DisableEntitiesTracking,
                DisableCaching      = DisableCaching,
                ShowQueryTimings    = ShowQueryTimings,
                LastEquality        = LastEquality,
                ShouldExplainScores = ShouldExplainScores,
                IsIntersect         = IsIntersect,
                DefaultOperator     = DefaultOperator
            };

            query.AfterQueryExecuted(AfterQueryExecutedCallback);
            return(query);
        }
Example #2
0
        private DocumentQuery <TResult> CreateDocumentQueryInternal <TResult>(FieldsToFetchToken newFieldsToFetch = null)
        {
            if (newFieldsToFetch != null)
            {
                UpdateFieldsToFetchToken(newFieldsToFetch);
            }

            var query = new DocumentQuery <TResult>(
                TheSession,
                IndexName,
                CollectionName,
                IsGroupBy)
            {
                QueryRaw           = QueryRaw,
                PageSize           = PageSize,
                SelectTokens       = SelectTokens,
                FieldsToFetchToken = FieldsToFetchToken,
                WhereTokens        = WhereTokens,
                OrderByTokens      = OrderByTokens,
                GroupByTokens      = GroupByTokens,
                QueryParameters    = QueryParameters,
                Start      = Start,
                Timeout    = Timeout,
                CutoffEtag = CutoffEtag,
                QueryStats = QueryStats,
                TheWaitForNonStaleResults        = TheWaitForNonStaleResults,
                TheWaitForNonStaleResultsAsOfNow = TheWaitForNonStaleResultsAsOfNow,
                Negate    = Negate,
                Includes  = new HashSet <string>(Includes),
                RootTypes = { typeof(T) },
                BeforeQueryExecutedCallback = BeforeQueryExecutedCallback,
                AfterQueryExecutedCallback  = AfterQueryExecutedCallback,
                AfterStreamExecutedCallback = AfterStreamExecutedCallback,
                HighlightedFields           = new List <HighlightedField>(HighlightedFields),
                HighlighterPreTags          = HighlighterPreTags,
                HighlighterPostTags         = HighlighterPostTags,
                DisableEntitiesTracking     = DisableEntitiesTracking,
                DisableCaching      = DisableCaching,
                ShowQueryTimings    = ShowQueryTimings,
                LastEquality        = LastEquality,
                ShouldExplainScores = ShouldExplainScores,
                IsIntersect         = IsIntersect,
                DefaultOperator     = DefaultOperator
            };

            query.AfterQueryExecuted(AfterQueryExecutedCallback);
            return(query);
        }