/// <summary>
        /// Configure core services
        /// </summary>
        /// <param name="serviceProvider">DI engine to be configured</param>
        /// <param name="options">Options to control SolrExpress behavior</param>
        internal static void Configure <TDocument>(ISolrExpressServiceProvider <TDocument> serviceProvider, SolrExpressOptions options)
            where TDocument : Document
        {
            serviceProvider
            .AddSingleton(options)
            .AddTransient(serviceProvider);

            var solrConnection    = new SolrConnection(options);
            var expressionBuilder = new ExpressionBuilder <TDocument>(options, solrConnection);

            if (!options.LazyInfraValidation)
            {
                expressionBuilder.LoadDocument();
            }

            serviceProvider
            .AddTransient(expressionBuilder)
            .AddTransient <DocumentSearch <TDocument> >()
            .AddTransient <DocumentUpdate <TDocument> >()
            .AddTransient <SearchResultBuilder <TDocument> >()
            .AddTransient <SearchQuery <TDocument> >()
            .AddTransient <ISolrConnection>(solrConnection)
            .AddTransient <IDocumentResult <TDocument>, DocumentResult <TDocument> >()
            .AddTransient <IChangeDynamicFieldBehaviour <TDocument>, ChangeDynamicFieldBehaviour <TDocument> >();
        }
示例#2
0
        /// <summary>
        /// Default constructor of class
        /// </summary>
        public DocumentUpdate(
            ISolrConnection solrConnection,
            ISolrExpressServiceProvider <TDocument> serviceProvider)
        {
            Checker.IsNull(solrConnection);
            Checker.IsNull(serviceProvider);

            this._solrConnection = solrConnection;
            this.ServiceProvider = serviceProvider;
        }
        public DocumentSearch(
            SolrExpressOptions solrExpressOptions,
            ISolrExpressServiceProvider <TDocument> serviceProvider,
            ISearchItemCollection <TDocument> searchItemCollection)
        {
            Checker.IsNull(solrExpressOptions);
            Checker.IsNull(serviceProvider);
            Checker.IsNull(searchItemCollection);

            this._solrExpressOptions   = solrExpressOptions;
            this._searchItemCollection = searchItemCollection;
            this.ServiceProvider       = serviceProvider;
        }
        public DocumentCollection(ISolrExpressServiceProvider <TDocument> serviceProvider)
        {
            Checker.IsNull(serviceProvider);

            this._serviceProvider = serviceProvider;
        }
示例#5
0
 public FacetRangeParameter(ExpressionBuilder <TDocument> expressionBuilder, ISolrExpressServiceProvider <TDocument> serviceProvider)
 {
     this.ExpressionBuilder = expressionBuilder;
     this.ServiceProvider   = serviceProvider;
 }
示例#6
0
 public SolrExpressBuilder(ISolrExpressServiceProvider <TDocument> serviceProvider)
 {
     this.ServiceProvider = serviceProvider;
 }
示例#7
0
 /// <summary>
 /// Create a filter parameter
 /// </summary>
 /// <param name="serviceProvider">Dependency injection engine</param>
 /// <returns>Filter parameter</returns>
 public static IFilterParameter <TDocument> Filter <TDocument>(this ISolrExpressServiceProvider <TDocument> serviceProvider)
     where TDocument : Document
 {
     return(serviceProvider.GetService <IFilterParameter <TDocument> >());
 }
示例#8
0
 /// <summary>
 /// Create a sort parameter configured to do a random sort
 /// </summary>
 /// <param name="serviceProvider">Dependency injection engine</param>
 /// <returns>Sort parameter configured to do a random sort</returns>
 public static ISortRandomlyParameter <TDocument> SortRandomly <TDocument>(this ISolrExpressServiceProvider <TDocument> serviceProvider)
     where TDocument : Document
 {
     return(serviceProvider.GetService <ISortRandomlyParameter <TDocument> >());
 }
示例#9
0
 /// <summary>
 /// Create a query field parameter
 /// </summary>
 /// <param name="serviceProvider">Dependency injection engine</param>
 /// <returns>Query field parameter</returns>
 public static IQueryFieldParameter <TDocument> QueryField <TDocument>(this ISolrExpressServiceProvider <TDocument> serviceProvider)
     where TDocument : Document
 {
     return(serviceProvider.GetService <IQueryFieldParameter <TDocument> >());
 }
示例#10
0
 /// <summary>
 /// Create a minimum should match
 /// </summary>
 /// <param name="serviceProvider">Dependency injection engine</param>
 /// <returns>Minimum should match</returns>
 public static IMinimumShouldMatchParameter <TDocument> MinimumShouldMatch <TDocument>(this ISolrExpressServiceProvider <TDocument> serviceProvider)
     where TDocument : Document
 {
     return(serviceProvider.GetService <IMinimumShouldMatchParameter <TDocument> >());
 }
示例#11
0
 public FacetQueryParameter(ISolrExpressServiceProvider <TDocument> serviceProvider)
 {
     this.ServiceProvider = serviceProvider;
 }