Skip to content

thecogworks/Cogworks.AzureSearch.IoC.Autofac

Repository files navigation

Cogworks.AzureSearch.IoC.Autofac · GitHub license Github Build NuGet Version codecov

An Autofac extension to Cogworks.AzureSearch.

Usage

Registration

_composing.RegisterAzureSearch()
    .RegisterClientOptions("[AzureSearchServiceName]", "[AzureSearchCredentials]")
    .RegisterIndexOptions(false, false) // for now required
    .RegisterIndexDefinitions<FirstDocumentModel>("first-document-index-name")
    .RegisterIndexDefinitions<SecondDocumentModel>("second-document-index-name")
    .RegisterIndexDefinitions<ThirdDocumentModel>(new Index{
        Name = "third-document-index-name",
        ScoringProfiles = new List<ScoringProfile>()
                {
                    new ScoringProfile("global-sp", new TextWeights(new Dictionary<string, double>()
                    {
                        {"Name", 10}, {"Content", 0.1}, {"Tags/Name", 0.1}
                    }),new List<ScoringFunction>()
                    {
                        new FreshnessScoringFunction("PublishDate", 20, TimeSpan.FromDays(180), ScoringFunctionInterpolation.Quadratic)
                    })
                } //and more custom properties to add
    })
    .RegisterDomainSearcher<SomeDomainSearch, ISomeDomainSearch, FirstDocumentModel>();

License

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.

Blogs

How can you help?

Please... Spread the word, contribute, submit improvements and issues, unit tests, no input is too little. Thank you in advance <3