Пример #1
0
        public IAsyncDocumentQuery <TTransformerResult> SetResultTransformer <TTransformer, TTransformerResult>()
            where TTransformer : AbstractTransformerCreationTask, new()
        {
            var documentQuery = new AsyncDocumentQuery <TTransformerResult>(theSession,
                                                                            theDatabaseCommands,
                                                                            theAsyncDatabaseCommands,
                                                                            indexName,
                                                                            fieldsToFetch,
                                                                            projectionFields,
                                                                            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         = new TTransformer().TransformerName,
                transformerParameters      = transformerParameters,
                disableEntitiesTracking    = disableEntitiesTracking,
                disableCaching             = disableCaching,
                showQueryTimings           = showQueryTimings,
                lastEquality               = lastEquality,
                defaultOperator            = defaultOperator,
                shouldExplainScores        = shouldExplainScores
            };

            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 IAsyncDocumentQuery <TProjection> SelectFields <TProjection>(string[] fields, string[] projections)
        {
            var asyncDocumentQuery = new AsyncDocumentQuery <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,
                afterQueryExecutedCallback  = afterQueryExecutedCallback,
                afterStreamExecutedCallback = afterStreamExecutedCallback,
                highlightedFields           = new List <HighlightedField>(highlightedFields),
                highlighterPreTags          = highlighterPreTags,
                highlighterPostTags         = highlighterPostTags,
                resultsTransformer          = resultsTransformer,
                transformerParameters       = transformerParameters,
                disableEntitiesTracking     = disableEntitiesTracking,
                disableCaching              = disableCaching,
                showQueryTimings            = showQueryTimings,
                lastEquality                = lastEquality,
                shouldExplainScores         = shouldExplainScores
            };

            asyncDocumentQuery.AfterQueryExecuted(afterQueryExecutedCallback);
            return(asyncDocumentQuery);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncSpatialDocumentQuery{T}"/> class.
        /// </summary>
        /// <param name="documentQuery">The document query.</param>
        public AsyncSpatialDocumentQuery(AsyncDocumentQuery <T> documentQuery)
            : base(documentQuery)
        {
            var other = documentQuery as AsyncSpatialDocumentQuery <T>;

            if (other == null)
            {
                return;
            }

            radius = other.radius;
            lat    = other.lat;
            lng    = other.lng;
        }
Пример #4
0
        /// <summary>
        /// Selects the specified fields directly from the index
        /// </summary>
        /// <typeparam name="TProjection">The type of the projection.</typeparam>
        public virtual IAsyncDocumentQuery <TProjection> SelectFields <TProjection>(string[] fields, string[] projections)
        {
            var asyncDocumentQuery = new AsyncDocumentQuery <TProjection>(theSession,
#if !SILVERLIGHT
                                                                          theDatabaseCommands,
#endif
                                                                          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,
                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,
                spatialUnits               = spatialUnits,
                distanceErrorPct           = distanceErrorPct,
                rootTypes                  = { typeof(T) },
                defaultField               = defaultField,
                beforeQueryExecutionAction = beforeQueryExecutionAction,
                afterQueryExecutedCallback = afterQueryExecutedCallback,
                highlightedFields          = new List <HighlightedField>(highlightedFields),
                highlighterPreTags         = highlighterPreTags,
                highlighterPostTags        = highlighterPostTags,
                resultsTransformer         = resultsTransformer,
                queryInputs                = queryInputs,
                disableEntitiesTracking    = disableEntitiesTracking,
                disableCaching             = disableCaching,
                lastEquality               = lastEquality
            };

            asyncDocumentQuery.AfterQueryExecuted(afterQueryExecutedCallback);
            return(asyncDocumentQuery);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpatialDocumentQuery&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="documentQuery">The document query.</param>
        /// <param name="sortByDistance">if set to <c>true</c> the query will be sorted by distance.</param>
        public AsyncSpatialDocumentQuery(AsyncDocumentQuery <T> documentQuery, bool sortByDistance)
            : base(documentQuery)
        {
            this.sortByDistance = sortByDistance;

            var other = documentQuery as AsyncSpatialDocumentQuery <T>;

            if (other == null)
            {
                return;
            }

            radius = other.radius;
            lat    = other.lat;
            lng    = other.lng;
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractDocumentQuery{T,TSelf}"/> class.
 /// </summary>
 public AsyncDocumentQuery(AsyncDocumentQuery <T> other)
     : base(other)
 {
 }