Пример #1
0
        /// <summary>
        /// Selects the specified fields directly from the index
        /// </summary>
        /// <typeparam name="TProjection">The type of the projection.</typeparam>
        /// <param name="fields">The fields.</param>
        public virtual IDocumentQuery <TProjection> SelectFields <TProjection>(string[] fields)
        {
            var documentQuery = new DocumentQuery <TProjection>(theSession,
#if !SILVERLIGHT
                                                                theDatabaseCommands,
#endif
#if !NET_3_5
                                                                theAsyncDatabaseCommands,
#endif
                                                                indexName, fields,
                                                                queryListeners)
            {
                pageSize     = pageSize,
                theQueryText = new StringBuilder(theQueryText.ToString()),
                start        = start,
                timeout      = timeout,
                cutoff       = cutoff,
                queryStats   = queryStats,
                theWaitForNonStaleResults = theWaitForNonStaleResults,
                sortByHints          = sortByHints,
                orderByFields        = orderByFields,
                groupByFields        = groupByFields,
                aggregationOp        = aggregationOp,
                negate               = negate,
                transformResultsFunc = transformResultsFunc,
                includes             = new HashSet <string>(includes),
                isSpatialQuery       = isSpatialQuery,
                lat    = lat,
                lng    = lng,
                radius = radius,
            };

            documentQuery.AfterQueryExecuted(afterQueryExecutedCallback);
            return(documentQuery);
        }
Пример #2
0
        /// <summary>
        /// Selects the specified fields directly from the index
        /// </summary>
        /// <typeparam name="TProjection">The type of the projection.</typeparam>
        public virtual IDocumentQuery <TProjection> SelectFields <TProjection>(string[] fields, string[] projections)
        {
            var documentQuery = new DocumentQuery <TProjection>(theSession,
                                                                theDatabaseCommands,
                                                                theAsyncDatabaseCommands,
                                                                indexName,
                                                                fields,
                                                                projections,
                                                                queryListeners,
                                                                isMapReduce)
            {
                pageSize   = pageSize,
                queryText  = new StringBuilder(queryText.ToString()),
                start      = start,
                timeout    = timeout,
                cutoff     = cutoff,
                cutoffEtag = cutoffEtag,
                queryStats = queryStats,
                theWaitForNonStaleResults        = theWaitForNonStaleResults,
                theWaitForNonStaleResultsAsOfNow = theWaitForNonStaleResultsAsOfNow,
                sortByHints   = sortByHints,
                orderByFields = orderByFields,
                isDistinct    = isDistinct,
                allowMultipleIndexEntriesForSameDocumentToResultTransformer = allowMultipleIndexEntriesForSameDocumentToResultTransformer,
                negate = negate,
                transformResultsFunc       = transformResultsFunc,
                includes                   = new HashSet <string>(includes),
                isSpatialQuery             = isSpatialQuery,
                spatialFieldName           = spatialFieldName,
                queryShape                 = queryShape,
                spatialRelation            = spatialRelation,
                spatialUnits               = spatialUnits,
                distanceErrorPct           = distanceErrorPct,
                rootTypes                  = { typeof(T) },
                defaultField               = defaultField,
                beforeQueryExecutionAction = beforeQueryExecutionAction,
                highlightedFields          = new List <HighlightedField>(highlightedFields),
                highlighterPreTags         = highlighterPreTags,
                highlighterPostTags        = highlighterPostTags,
                resultsTransformer         = resultsTransformer,
                transformerParameters      = transformerParameters,
                disableEntitiesTracking    = disableEntitiesTracking,
                disableCaching             = disableCaching,
                showQueryTimings           = showQueryTimings,
                lastEquality               = lastEquality,
                defaultOperator            = defaultOperator,
                shouldExplainScores        = shouldExplainScores
            };

            documentQuery.AfterQueryExecuted(afterQueryExecutedCallback);
            return(documentQuery);
        }
Пример #3
0
        /// <summary>
        /// Selects the specified fields directly from the index
        /// </summary>
        /// <typeparam name="TProjection">The type of the projection.</typeparam>
        public virtual IDocumentQuery <TProjection> SelectFields <TProjection>(string[] fields, string[] projections)
        {
            var documentQuery = new DocumentQuery <TProjection>(theSession,
#if !SILVERLIGHT
                                                                theDatabaseCommands,
#endif
#if !NET35
                                                                theAsyncDatabaseCommands,
#endif
                                                                indexName,
                                                                fields,
                                                                projections,
                                                                queryListeners)
            {
                pageSize     = pageSize,
                theQueryText = new StringBuilder(theQueryText.ToString()),
                start        = start,
                timeout      = timeout,
                cutoff       = cutoff,
                cutoffEtag   = cutoffEtag,
                queryStats   = queryStats,
                theWaitForNonStaleResults = theWaitForNonStaleResults,
                sortByHints          = sortByHints,
                orderByFields        = orderByFields,
                groupByFields        = groupByFields,
                aggregationOp        = aggregationOp,
                negate               = negate,
                transformResultsFunc = transformResultsFunc,
                includes             = new HashSet <string>(includes),
                isSpatialQuery       = isSpatialQuery,
                spatialFieldName     = spatialFieldName,
                queryShape           = queryShape,
                spatialRelation      = spatialRelation,
                distanceErrorPct     = distanceErrorPct,
                rootTypes            = { typeof(T) }
            };

            documentQuery.AfterQueryExecuted(afterQueryExecutedCallback);
            return(documentQuery);
        }