Exemplo n.º 1
0
        //private MapFieldSelector fieldSelector;

        public AzureSearchResults(AzureSearchContext context, AzureQuery query, DocumentSearchResult searchHits, int startIndex, int endIndex, SelectMethod selectMethod, IEnumerable <IExecutionContext> executionContexts, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, FieldNameTranslator fieldNameTranslator)
        {
            this.context                = context;
            this.query                  = query;
            this.searchHits             = searchHits;
            this.startIndex             = startIndex;
            this.endIndex               = endIndex;
            this.selectMethod           = selectMethod;
            this.virtualFieldProcessors = virtualFieldProcessors;
            this.fieldNameTranslator    = fieldNameTranslator;
            this.configuration          = (AzureIndexConfiguration)context.Index.Configuration;
            //this.fieldSelector = (MapFieldSelector)null;
            this.executionContexts = executionContexts;
            var executionContext = this.executionContexts != null?Enumerable.FirstOrDefault <IExecutionContext>(this.executionContexts, (Func <IExecutionContext, bool>)(c => c is OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >)) as OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> > : (OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >)null;

            this.mapper = (executionContext != null ? executionContext.OverrideObject : null) ?? this.configuration.IndexDocumentPropertyMapper;
            //if (selectMethod != null && selectMethod.FieldNames != null && selectMethod.FieldNames.Length > 0)
            //{
            //    this.fieldSelector = this.GetMapFieldSelector(context, (IEnumerable<string>)selectMethod.FieldNames);
            //}
            //else
            //{
            //    if (this.selectMethod != null)
            //        return;
            //    IEnumerable<string> documentFieldsToRead = this.mapper.GetDocumentFieldsToRead<TElement>(executionContexts);
            //    this.fieldSelector = this.GetMapFieldSelector(context, documentFieldsToRead);
            //}
        }
            public SolrSearchResults(SolrSearchContext context, SolrQueryResults <Dictionary <string, object> > searchResults, SelectMethod selectMethod, IEnumerable <IExecutionContext> executionContexts, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors)
            {
                this._context = context;
                this._solrIndexConfiguration = (SolrIndexConfiguration)this._context.Index.Configuration;
                this._selectMethod           = selectMethod;
                this._virtualFieldProcessors = virtualFieldProcessors;
                this._executionContexts      = executionContexts;
                this._numberFound            = searchResults.NumFound;
                this._searchResults          = ApplySecurity(searchResults, context.SecurityOptions, ServiceLocator.ServiceProvider.GetService <BaseCorePipelineManager>(), context.Index.Locator.GetInstance <IAccessRight>(), ref this._numberFound);
                var executionContext = this._executionContexts != null?this._executionContexts.FirstOrDefault(c => c is OverrideExecutionContext <IIndexDocumentPropertyMapper <Dictionary <string, object> > >) as OverrideExecutionContext <IIndexDocumentPropertyMapper <Dictionary <string, object> > > : null;

                this._mapper = (executionContext != null ? executionContext.OverrideObject : null) ?? this._solrIndexConfiguration.IndexDocumentPropertyMapper;
            }