/// <summary>
        /// Gets a queryable for Synthesis items
        /// </summary>
        /// <typeparam name="TResult">The type of the result item to bind to.</typeparam>
        /// <param name="context">The search context to use</param>
        /// <param name="applyStandardFilters">Controls whether results will be auto-filtered to context language, correct template, and latest version</param>
        /// <param name="executionContext">The execution context to run the query under</param>
        /// <returns>A queryable item that standard Sitecore LINQ can be used on</returns>
        public static IQueryable <TResult> GetSynthesisQueryable <TResult>(this IProviderSearchContext context, bool applyStandardFilters, params IExecutionContext[] executionContext)
            where TResult : IStandardTemplateItem
        {
            IQueryable <TResult> queryable;

            var luceneContext = context as LuceneSearchContext;

            if (luceneContext != null)
            {
                var overrideMapper = new SynthesisLuceneDocumentTypeMapper();
                overrideMapper.Initialize(context.Index);

                var mapperExecutionContext = new OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >(overrideMapper);
                var executionContexts      = new List <IExecutionContext>();
                if (executionContext != null)
                {
                    executionContexts.AddRange(executionContext);
                }
                executionContexts.Add(mapperExecutionContext);

                queryable = GetLuceneQueryable <TResult>(luceneContext, executionContexts.ToArray());
            }
            else
            {
                // TODO: possible SOLR support with different mapper
                throw new NotImplementedException("At this time Synthesis only supports Lucene indexes.");
            }

            if (applyStandardFilters)
            {
                queryable = queryable.ApplyStandardFilters();
            }

            return(queryable);
        }
        public IQueryable <TResult> GetSynthesisQueryable <TResult>(SynthesisSearchContextArgs args) where TResult : IStandardTemplateItem
        {
            Assert.IsNotNull(args, "Args must not be null");
            if (!(args.SearchContext is SolrSearchContext solrContext))
            {
                throw new NotImplementedException("A Solr index is not being used, if you're using Azure make sure that you're not overridding the synthesisSearchContext pipeline with the Solr processor");
            }

            var overrideMapper = new SynthesisSolrDocumentTypeMapper();

            overrideMapper.Initialize(args.SearchContext.Index);
            var mapperExecutionContext = new OverrideExecutionContext <IIndexDocumentPropertyMapper <Dictionary <string, object> > >(overrideMapper);
            var executionContexts      = new List <IExecutionContext>();

            if (args.ExecutionContext != null)
            {
                executionContexts.AddRange(args.ExecutionContext);
            }
            executionContexts.Add(mapperExecutionContext);
            return(GetSolrQueryable <TResult>(solrContext, executionContexts.ToArray()));
        }
        public IQueryable <TResult> GetSynthesisQueryable <TResult>(SynthesisSearchContextArgs args) where TResult : IStandardTemplateItem
        {
            Assert.IsNotNull(args, "Args must not be null");
            var luceneContext = args.SearchContext as LuceneSearchContext;

            if (luceneContext == null)
            {
                throw new NotImplementedException("A Lucene index is not being used, if you're using Solr make sure that you're overridding the synthesisSearchContext pipeline with the Solr processor in Synthesis.Solr");
            }

            var overrideMapper = new SynthesisLuceneDocumentTypeMapper();

            overrideMapper.Initialize(args.SearchContext.Index);

            var mapperExecutionContext = new OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >(overrideMapper);
            var executionContexts      = new List <IExecutionContext>();

            if (args.ExecutionContext != null)
            {
                executionContexts.AddRange(args.ExecutionContext);
            }
            executionContexts.Add(mapperExecutionContext);
            return(GetLuceneQueryable <TResult>(luceneContext, executionContexts.ToArray()));
        }