public LuceneSearchWithSpatialContext(ILuceneProviderIndex index, SearchSecurityOptions securityOptions = SearchSecurityOptions.EnableSecurityCheck)
     : base(index, securityOptions)
 {
     Assert.ArgumentNotNull(index, "index");
     this.index    = index;
     this.settings = this.index.Locator.GetInstance <IContentSearchConfigurationSettings>();
 }
 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;
 }
 public SolrSearchWithSpatialContext(SolrSearchIndex index, SearchSecurityOptions options = SearchSecurityOptions.EnableSecurityCheck)
     : base(index, options)
 {
     Assert.ArgumentNotNull((object)index, "index");
     Assert.ArgumentNotNull((object)options, "options");
     this.index = index;
     this.contentSearchSettings = this.index.Locator.GetInstance <IContentSearchConfigurationSettings>();
     this.settings        = this.index.Locator.GetInstance <ISettings>();
     this.securityOptions = options;
 }
        public AzureUpdateContext(ISearchIndex index)
        {
            Assert.ArgumentNotNull(index, "index");

            Index = index;
            this.contentSearchSettings = index.Locator.GetInstance<IContentSearchConfigurationSettings>();
            IsParallel = this.contentSearchSettings.IsParallelIndexingEnabled();
            this.ParallelOptions = new ParallelOptions();
            int num = this.contentSearchSettings.ParallelIndexingMaxThreadLimit();
            if (num > 0)
                this.ParallelOptions.MaxDegreeOfParallelism = num;
            this.CommitPolicyExecutor = new NullCommitPolicyExecutor();
        }
        public FacetLinqToSolrIndex(SolrSearchContext context, IExecutionContext executionContext)
            : base(context, executionContext)
        {
            Assert.ArgumentNotNull(context, "context");
            this._context  = context;
            this._settings = context.Index.Locator.GetInstance <ISettings>();
            this._contentSearchSettings = context.Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
            var executionContext1 = this.Parameters.ExecutionContext as CultureExecutionContext;
            var culture           = executionContext1 == null?CultureInfo.GetCultureInfo(Settings.DefaultLanguage) : executionContext1.Culture;

            this._cultureCode = culture.TwoLetterISOLanguageName;
            ((SolrFieldNameTranslator)this.Parameters.FieldNameTranslator).AddCultureContext(culture);
            this.PublicFieldNameTranslator = this.FieldNameTranslator;
        }
        public AzureUpdateContext(ISearchIndex index)
        {
            Assert.ArgumentNotNull(index, "index");

            Index = index;
            this.contentSearchSettings = index.Locator.GetInstance <IContentSearchConfigurationSettings>();
            IsParallel           = this.contentSearchSettings.IsParallelIndexingEnabled();
            this.ParallelOptions = new ParallelOptions();
            int num = this.contentSearchSettings.ParallelIndexingMaxThreadLimit();

            if (num > 0)
            {
                this.ParallelOptions.MaxDegreeOfParallelism = num;
            }
            this.CommitPolicyExecutor = new NullCommitPolicyExecutor();
        }
Пример #7
0
        protected AbstractDocumentBuilder(IIndexable indexable, IProviderUpdateContext context)
        {
            Assert.ArgumentNotNull(indexable, "indexable");
            Assert.ArgumentNotNull(context, "context");
            Options         = context.Index.Configuration.DocumentOptions;
            Indexable       = indexable;
            Index           = context.Index;
            Document        = new T();
            IsParallel      = context.IsParallel;
            ParallelOptions = context.ParallelOptions;
            var obj = (Item)(indexable as SitecoreIndexableItem);

            if (obj != null)
            {
                IsTemplate = TemplateManager.IsTemplate(obj);
                IsMedia    = obj.Paths.IsMediaItem;
            }
            Settings = Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
        }
Пример #8
0
        public SSSolrSearchContext(SSSolrSearchIndex index, SearchSecurityOptions options = SearchSecurityOptions.Default)
        {
            Assert.ArgumentNotNull(index, nameof(index));
            Assert.ArgumentNotNull(options, nameof(options));
            if (options == SearchSecurityOptions.Default)
            {
                options = index.Configuration.DefaultSearchSecurityOption;
            }
            this.index            = index;
            contentSearchSettings = index.Locator.GetInstance <IContentSearchConfigurationSettings>();
            settings        = index.Locator.GetInstance <ISettings>();
            securityOptions = options;

            var solrUrl = $"{SolrContentSearchManager.SolrSettings.ServiceAddress().TrimEnd('/')}/";

            _api = new SearchContext(new System.Net.Http.HttpClient
            {
                BaseAddress = new Uri(solrUrl)
            }, index.Core, new SitecoreNodeTranslator(new FieldTranslator(index.FieldNameTranslator)), new ResposeTranslator(index.FieldNameTranslator));
        }
        public LinqToSolrIndexExtended([NotNull] SolrSearchContext context, IExecutionContext[] executionContexts)
            : base(
                new SolrIndexParameters(
                    context.Index.Configuration.IndexFieldStorageValueFormatter,
                    context.Index.Configuration.VirtualFields,
                    context.Index.FieldNameTranslator,
                    executionContexts[0]))
        {
            Assert.ArgumentNotNull(context, "context");
            this.context = context;

            contentSearchSettings = context.Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
            pipeline = context.Index.Locator.GetInstance <Sitecore.Abstractions.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);
        }
 public SolrSearchContext(Sitecore.ContentSearch.SolrProvider.SolrSearchIndex index, SearchSecurityOptions options = SearchSecurityOptions.EnableSecurityCheck)
     : base(index, options)
 {
     this.settings = this.Index.Locator.GetInstance <IContentSearchConfigurationSettings>();
 }