Orvina.Engine 1.6.1

dotnet add package Orvina.Engine --version 1.6.1
NuGet\Install-Package Orvina.Engine -Version 1.6.1
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="Orvina.Engine" Version="1.6.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Orvina.Engine --version 1.6.1
#r "nuget: Orvina.Engine, 1.6.1"
#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 Orvina.Engine as a Cake Addin
#addin nuget:?package=Orvina.Engine&version=1.6.1

// Install Orvina.Engine as a Cake Tool
#tool nuget:?package=Orvina.Engine&version=1.6.1

Orvina

Introduction

This is a high performance text search utility written in C#/.NET 6. Speed, ease of use, and robustness were all accounted for in the development of Orvina. Text search allows for basic wildcards like " * " (0 or more characters) and " ? " (any character). Case sensitivity can be enabled with "-cases" parameter.

This repository contains 2 projects:

  1. Orvina.Console

    • Console Application - Download Exe
    • Builds the application for searching files for text
    • The output will list the files containing the search text and show the lines of the file containing the search text
    • Example usage:
    orvina.exe "C:\my files" "search text" .cs,.js
    
    1. When the search completes, you may enter the (Id) of the file containing matching text to open it

    orvina_finished.png

    1. Wildcards "?" and "*" are supported. So "p?n" will match "pen" and "pin". And "b*d" will match "bind" and "bound".
  2. Orvina.Engine

    • Class Library available as a nuget package
    • The only dependency of Orvina.Console
    • Example usage:
    using (var search = new Orvina.Engine.SearchEngine())
    {
            search.OnError += Search_OnError;
            search.OnFileFound += Search_OnFileFound;
            search.OnSearchComplete += Search_OnSearchComplete;
            search.OnProgress += Search_OnProgress;
    
            search.Start(searchPath, includeSubdirectories, searchText, fileExtensions);
    
            //TODO
            //wait for the OnSearchComplete event before Disposing
    }
    

Under the hood

Orvina.Engine is multithreaded to build the result list as quickly as possible on your machine. While no amount of multithreading can fix a slow disk (I/O reads), care was taken to allow the disk to be as efficient as possible. This is achieved with a clever queuing and locking model that allows files streaming off of the disk to be promptly scanned.

Directory Thread

These are the first batch of threads that run and use the latest file enumerators available in .NET 6 that call directly into NTDLL.DLL. They recursively scan the root folder and its subfolders. While scanning the folder tree, it also tracks an shared list of files that have the desire file extension(s). Such as .cs or .js.

File Tractor

The file tractor leverages Asynchronous File I/O built into the OS. It allows file streaming from the disk to be stored as raw bytes in a memory queue. Any available threads will pull from this queue to scan the file for matching "search text".

Text Search Thread

Threads of this type will read the in-memory file byte stream. They read from the File Tractor queue and convert the byte stream to UTF8 text. The reads are synchronized such that only 1 thread may read a file at a time.

Search Mechanism

Orvina converts your search string to bytes and searches for the matching byte string in your files. For search queries that use "*" wildcards, a small state machine is used to determine if the search text exists in a line of text.

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.
  • net6.0

    • No dependencies.

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.6.1 458 4/1/2022
1.6.0 379 3/25/2022
1.5.0 376 3/12/2022
1.0.2 396 2/27/2022
1.0.1 378 2/25/2022
1.0.0 383 2/24/2022

~10% better performance for "*" searches. Better handling of newline & carriage returns.