private static SolrQueryResults <Dictionary <string, object> > ApplySecurity(SolrQueryResults <Dictionary <string, object> > solrQueryResults, SearchSecurityOptions options, BaseCorePipelineManager pipeline, IAccessRight accessRight, ref int numberFound)
            {
                if (!options.HasFlag(SearchSecurityOptions.DisableSecurityCheck))
                {
                    var hashSet = new HashSet <Dictionary <string, object> >();
                    foreach (var dictionary in solrQueryResults.Where(searchResult => searchResult != null))
                    {
                        object obj1;
                        if (dictionary.TryGetValue("_uniqueid", out obj1))
                        {
                            object obj2;
                            dictionary.TryGetValue("_datasource", out obj2);

                            var args = new OutboundIndexFilterArgs((string)obj1, (string)obj2)
                            {
                                AccessRight = accessRight.ItemRead()
                            };

                            pipeline.Run("indexing.filterIndex.outbound", args);

                            if (args.IsExcluded)
                            {
                                hashSet.Add(dictionary);
                                numberFound = numberFound - 1;
                            }
                        }
                    }
                    foreach (var dictionary in hashSet)
                    {
                        solrQueryResults.Remove(dictionary);
                    }
                }
                return(solrQueryResults);
            }
Пример #2
0
        public float[] GetItemVector(Item item)
        {
            var messageBusFactory = ServiceLocator.ServiceProvider.GetService <IMessageBusFactory>();
            var messageBus        = messageBusFactory.Create();
            BaseCorePipelineManager PipelineManager = ServiceLocator.ServiceProvider.GetService <BaseCorePipelineManager>();;
            string pipelineDomain = "RealtedContentTagging";

            var configurationArgs = new GetRelatedContentTaggingConfigurationArgs
            {
                MessageBus = messageBus
            };

            PipelineManager.Run("getRelatedTaggingConfiguration", configurationArgs, pipelineDomain);
            BaseCorePipelineManager pipelineManager = PipelineManager;
            var tagContentArgs = new RelatedContentTagArgs
            {
                Configuration = new RelatedItemContentTaggingProvidersSet
                {
                    ContentProviders  = configurationArgs.ProvidersSet.ContentProviders,
                    Taggers           = configurationArgs.ProvidersSet.Taggers,
                    DiscoveryProvider = configurationArgs.ProvidersSet.DiscoveryProvider,
                },
                ContentItem = item,
                MessageBus  = messageBus
            };

            pipelineManager.Run("getContent", tagContentArgs, pipelineDomain);
            return(tagContentArgs.Vector);
        }
        public void Run(Item contentItem, MessageBus messageBus)
        {
            string pipelineDomain = "RealtedContentTagging";

            var configurationArgs = new GetRelatedContentTaggingConfigurationArgs
            {
                MessageBus = messageBus
            };

            PipelineManager.Run("getRelatedTaggingConfiguration", configurationArgs, pipelineDomain);
            BaseCorePipelineManager pipelineManager = PipelineManager;
            string pipelineName = "tagContent";
            RelatedContentTagArgs tagContentArgs = new RelatedContentTagArgs
            {
                Configuration = new RelatedItemContentTaggingProvidersSet
                {
                    ContentProviders  = configurationArgs.ProvidersSet.ContentProviders,
                    Taggers           = configurationArgs.ProvidersSet.Taggers,
                    DiscoveryProvider = configurationArgs.ProvidersSet.DiscoveryProvider,
                },
                ContentItem = contentItem,
                MessageBus  = messageBus
            };

            pipelineManager.Run(pipelineName, tagContentArgs, pipelineDomain);
        }
Пример #4
0
        public override object TransformPlaceholderElement(RenderedPlaceholderElement element)
        {
            var transformedElement         = base.TransformPlaceholderElement(element);
            var renderingConfigurationName = GetRenderingConfigurationName(element);

            var args = new TransformPlaceholderElementPipelineArgs(element, renderingConfigurationName, transformedElement);

            _pipelineManager.Run(PipelineName, args, GroupName);
            return(args.Result);
        }