FastDex 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FastDex --version 1.0.0                
NuGet\Install-Package FastDex -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="FastDex" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FastDex --version 1.0.0                
#r "nuget: FastDex, 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 FastDex as a Cake Addin
#addin nuget:?package=FastDex&version=1.0.0

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

FastDex

Fast inverted index powered by Lucene .NET.

Getting Started

Create an index, by default file storage is used:

// creates directory "myindex" if it doesn't exist, rebuilds stale index if necessarry
InvertedIndex index = new InvertedIndex($"myindex");

Add some documents:

List<IndexDocument> sourceDocuments =
[
    new IndexDocument { Content = "public v[oi]d Method() ú", Id = "1" },
    new IndexDocument { Content = "int x = 5 * 3; ú", Id = "2" },
    new IndexDocument { Content = "if (condition) { }", Id = "3" },
];

/* removes any other documents currently indexed, updates the existing documents if content changed
   can report progress */
index.SynchronizeIndex(sourceDocuments);

Alternatively, add/update and delete documents manually:

index.IndexDocument("document content", "1"); // add/update
index.DeleteDocument("1");

Finally, search the index:

// supported features: case (in)sensitivity, whole words search, paging
List<SearchResult> results = SharedIndex.Search("x =");

Gotchas

  • Dispose() the index once it's no longer needed.
  • The index can be searched, from multiple threads (near realtime).
  • The index can be opened only once, use it as a static resource and dispose when closing the application, eg. lifetime.ApplicationStopping.Register(() => { myindex.Dipose(); }); in .NET Core.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.1 79 11/2/2024
1.0.0 95 10/5/2024