AuraSearch 1.0.0

dotnet add package AuraSearch --version 1.0.0
NuGet\Install-Package AuraSearch -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AuraSearch" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AuraSearch --version 1.0.0
#r "nuget: AuraSearch, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AuraSearch as a Cake Addin
#addin nuget:?package=AuraSearch&version=1.0.0

// Install AuraSearch as a Cake Tool
#tool nuget:?package=AuraSearch&version=1.0.0

aura-search-net

Lightweight search library for .NET

It's based on dynamic weights.

Quick start:

Register Dependencies: (with your implementation for repositories)

       // register services
        services.AddTransient<IWordRepository, WordRepository>();
        services.AddTransient<IThoughtRepository, ThoughtRepository>();
        services.AddTransient<ISymbolComparer, DefaultSymbolComparer>();
        services.AddTransient<IStringCompareAlgorithm, StringMatcher>(); 
        
        

services.AddTransient<IContextRepository, ClientRepository>();

//register usecases  
        services.AddTransient<IUseCase<StoreIndexRequest>, CreateIndexUseCase>(); 
        services.AddTransient<IUseCase<ReinforceRequest>, ReinforceUseCase>(); 
        services.AddTransient<IUseCase<SearchRequest>, SearchUseCase>(); 
        services.AddSingleton<IOptions<Settings>>(_ => Options.Create<Settings>(new Settings()));

        // register filters  
        services.AddTransient<IInputFilter<ReinforceRequest>, ReinforceTokenizerFilter>();
        services.AddTransient<IInputFilter<StoreIndexRequest>, TokenizerInputFilter>();
        services.AddTransient<IInputFilter<SearchRequest>, TokenizerSearchRequestFilter>();
        services.AddTransient<IInputFilter<StoreIndexRequest>, ProduceSymbolsFilter>();

        //// Register event handlers 
        services.AddTransient(typeof(IEventHandler<ActivationEvent>), typeof(MatchMetricHandler));
        services.AddTransient(typeof(IEventHandler<MistmatchEvent>), typeof(MismatchMetricHandler));
        services.AddTransient(typeof(IEventHandler<RefreshEvent>), typeof(RefreshEventHandler));
        services.AddTransient(typeof(IEventHandler<AddToContextEvent>), typeof(AddToContextHandler));
        
        

How TO USE

Create an Index

var context = await _contextAccessor.GetContextAsync(request.ClientIdentifier, cancellationToken);
        var storeRequest = new StoreIndexRequest
        {
            ClientIdentifier = context.ClientIdentifier,
            Payloads = new List<Payload> {
                 new Payload
                 {
                      Document = request.OriginalRequest,
                      Title = request.OriginalRequest
                 }
             }
        };

        await _storeUseCase.Execute(storeRequest, context, cancellationToken);
        
    var context = await _contextAccessor.GetContextAsync(request.ClientIdentifier, cancellationToken);

        var searchRequest = new SearchRequest
        {
            ClientIdentifier = context.ClientIdentifier,
            Request = request.OriginalRequest
        };

        await _searchUseCase.Execute(searchRequest, context, cancellationToken);


        var lastResult = _searchOutput.GetLatestResult(request.ClientIdentifier); // The search results should be accessed from output port that has been registered in services  
        

Reinforce

var context = await _contextAccessor.GetContextAsync(request.ClientIdentifier, cancellationToken);

            var reinforceRequest = new ReinforceRequest
            {
                ClientIdentifier = request.ClientIdentifier,
                Type = ReinforceType.Boost,
                ThoughtId = request.Context.State.ThoughtId,
                IdeaId = request.Context.State.IdeaId,
                OriginalRequest = request.Context.State.Request
            };

            await _reinforceUseCase.Execute(reinforceRequest, context, cancellationToken);
            
            
            

Append Index

 var context = await _contextAccessor.GetContextAsync(request.ClientIdentifier, cancellationToken);

        var reinforceRequest = new ReinforceRequest
        {
            ClientIdentifier = request.ClientIdentifier,
            Type = ReinforceType.Append,
            ThoughtId = request.Context.State.ThoughtId,
            Addition = request.OriginalRequest,
            OriginalRequest = request.Context.State.Request
        };

        await _reinforceUseCase.Execute(reinforceRequest, context, cancellationToken);

Settings

Also you can adjust settings related to indexing, search thresshold

   public sealed class Settings
    {
        public double DefNeuronDom { get; set; } = 0.02d;
        public double NeuronReinforce { get; set; } = 0.0030d;
        public int MinimumSymbolLength { get; set; } = 2;
        public double NeuronDominanceWeigh { get; set; } = 0.08d;
        public double ActivationThress { get; set; } = .58d;
      
        public int WordCounterThresshold = 3;

        public int WordsToIndexThresshold = 15; 
    } 
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 202 5/10/2023

Iniutial release