public QueryableDatasourceRenderingModel(
   IRenderingPropertiesRepository renderingPropertiesRepository,
   ICorePipeline corePipeline)
 {
   this.renderingPropertiesRepository = renderingPropertiesRepository;
   this.CorePipeline = corePipeline;
 }
 public QueryableDatasourceRenderingModel(
     IRenderingPropertiesRepository renderingPropertiesRepository,
     ICorePipeline corePipeline)
 {
     this.renderingPropertiesRepository = renderingPropertiesRepository;
     this.CorePipeline = corePipeline;
 }
 public LinqToAzureIndex(AzureSearchContext context, IExecutionContext[] executionContexts)
     : base(new AzureIndexParameters(context.Index.Configuration.IndexFieldStorageValueFormatter, context.Index.Configuration.VirtualFields, context.Index.FieldNameTranslator, (fieldName => context.Index.Configuration.FieldMap.GetFieldConfiguration(fieldName) as IAzureSearchFieldConfiguration), executionContexts, context.Index.Configuration.FieldMap, context.ConvertQueryDatesToUtc))
 {
     Assert.ArgumentNotNull(context, "context");
     settings     = context.Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
     pipeline     = context.Index.Locator.GetInstance <ICorePipeline>();
     this.context = context;
 }
Example #4
0
        public void SutInstantiatesCustomCorePipelineWrapper(
            IRenderingPropertiesRepository renderingRepository,
            ICorePipeline corePipeline)
        {
            var sut = new QueryableDatasourceRenderingModel(renderingRepository, corePipeline);

            sut.CorePipeline.Should().BeSameAs(corePipeline);
        }
 public void ShouldReturnCurrentNameByIIndexableAndIPipeline(
   [Frozen] SearchProvider current,
   Switcher<SearchProvider> switcher,
   IIndexable indexable,
   ICorePipeline pipeline,
   string expected,
   SwitchingSearchProvider sut)
 {
   current.GetContextIndexName(indexable, pipeline).Returns(expected);
   sut.GetContextIndexName(indexable, pipeline).Should().Be(expected);
 }
 public void ShouldReturnCurrentNameByIIndexableAndIPipeline(
     [Frozen] SearchProvider current,
     Switcher <SearchProvider> switcher,
     IIndexable indexable,
     ICorePipeline pipeline,
     string expected,
     SwitchingSearchProvider sut)
 {
     current.GetContextIndexName(indexable, pipeline).Returns(expected);
     sut.GetContextIndexName(indexable, pipeline).Should().Be(expected);
 }
Example #7
0
 public BeaconController(IRepository <BeaconEntity> repository, ILog logger, ICorePipeline pipeline, ITrackerProvider trackerProvider, ISitecoreContext sitecoreContext, ISettings settings, IRequestHelper request, HttpContextBase httpContext, IWebClient client, ITrackingManager trackingManager) : base(repository)
 {
     Assert.ArgumentNotNull(logger, "logger");
     Assert.ArgumentNotNull(pipeline, "pipeline");
     Assert.ArgumentNotNull(settings, "settings");
     Assert.ArgumentNotNull(trackerProvider, "TrackerProvider");
     Assert.ArgumentNotNull(client, "client");
     Assert.ArgumentNotNull(trackingManager, "trackingManager");
     this.logger           = logger;
     this.pipeline         = pipeline;
     this.trackerProvider  = trackerProvider;
     this.sitecoreSettings = settings;
     this.requestHelper    = request;
     this.sitecoreContext  = sitecoreContext;
     this.trackingManager  = trackingManager;
     this.httpContextBase  = httpContext;
     this.webClient        = client;
 }
        public LinqToSolrIndexExtended([NotNull] SolrSearchContext context, IExecutionContext[] executionContexts)
            : base(
                new SolrIndexParameters(
                    context.Index.Configuration.IndexFieldStorageValueFormatter,
                    context.Index.Configuration.VirtualFieldProcessors,
                    context.Index.FieldNameTranslator,
                    executionContexts))
        {
            Assert.ArgumentNotNull(context, "context");
            this.context = context;

            contentSearchSettings = context.Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
            pipeline = context.Index.Locator.GetInstance <ICorePipeline>();

            var cultureExecutionContext = this.Parameters.ExecutionContexts.FirstOrDefault(c => c is CultureExecutionContext) as CultureExecutionContext;

            var culture = cultureExecutionContext == null
                               ? CultureInfo.GetCultureInfo(Settings.DefaultLanguage)
                               : cultureExecutionContext.Culture;

            this.cultureCode = culture.TwoLetterISOLanguageName;

            ((SolrFieldNameTranslator)this.Parameters.FieldNameTranslator).AddCultureContext(culture);

            var curType = this.context.Index.GetType();

            // TODO Check it e.g. when interfaces exist
            while (curType != typeof(Sitecore.ContentSearch.SolrProvider.SolrSearchIndex) && curType.BaseType != typeof(System.Object))
            {
                curType = curType.BaseType;
            }

            if (curType != typeof(Sitecore.ContentSearch.SolrProvider.SolrSearchIndex))
            {
                throw new InvalidOperationException("Can't get the SolrSearchIndex type...");
            }

            indexOperationsInfo = curType.GetProperty("SolrOperations", BindingFlags.Instance | BindingFlags.NonPublic);
        }
Example #9
0
        private static SolrQueryResults <Dictionary <string, object> > ApplySecurity(SolrQueryResults <Dictionary <string, object> > solrQueryResults, SearchSecurityOptions options, ICorePipeline pipeline, IAccessRight accessRight, ref int numberFound)
        {
            if (!options.HasFlag(SearchSecurityOptions.DisableSecurityCheck))
            {
                var removalList = new HashSet <Dictionary <string, object> >();

                foreach (var searchResult in solrQueryResults.Where(searchResult => searchResult != null))
                {
                    object secToken;
                    object dataSource;

                    if (!searchResult.TryGetValue(BuiltinFields.UniqueId, out secToken))
                    {
                        continue;
                    }

                    searchResult.TryGetValue(BuiltinFields.DataSource, out dataSource);

                    var isExcluded = OutboundIndexFilterPipeline.CheckItemSecurity(pipeline, accessRight, new OutboundIndexFilterArgs((string)secToken, (string)dataSource));

                    if (isExcluded)
                    {
                        removalList.Add(searchResult);
                        numberFound = numberFound - 1;
                    }
                }

                foreach (var item in removalList)
                {
                    solrQueryResults.Remove(item);
                }
            }

            return(solrQueryResults);
        }
 public override string GetContextIndexName(IIndexable indexable, ICorePipeline pipeline)
 {
   var currentProvider = Switcher<SearchProvider>.CurrentValue;
   return currentProvider != null ? currentProvider.GetContextIndexName(indexable, pipeline) : null;
 }
 public void SutInstantiatesCustomCorePipelineWrapper(
   IRenderingPropertiesRepository renderingRepository,
   ICorePipeline corePipeline)
 {
   var sut = new QueryableDatasourceRenderingModel(renderingRepository, corePipeline);
   sut.CorePipeline.Should().BeSameAs(corePipeline);
 }
        public override string GetContextIndexName(IIndexable indexable, ICorePipeline pipeline)
        {
            var currentProvider = Switcher <SearchProvider> .CurrentValue;

            return(currentProvider != null?currentProvider.GetContextIndexName(indexable, pipeline) : null);
        }
 public override string GetContextIndexName(IIndexable indexable, ICorePipeline pipeline)
 {
     var objContextIndexArgs = new GetContextIndexArgs(indexable);
     return GetContextIndexPipeline.Run(pipeline, objContextIndexArgs);
 }