You can use this nuget package Bsa.Search.Core.
This package compatible with .Net Core 3.1 and has no dependencies.
The library contains 3 index types:
- MemoryDocumentIndex - fast memory index
- DiskDocumentIndex stores the index on disk
- DiskShardDocumentIndex stores large indexes on disk of more than 3 million documents
Example of using Memory index
var field = "*"; // search in any field
var query = "(first & \"second and four*\") | (four* ~3 \'six\')"; //search word: first and phrase with wildcard or four- wildcard on distance 3 with six
var documentIndex = new MemoryDocumentIndex();// instance of new memory index
var content = "six first second four"; // text that is indexed
var searchService = new SearchServiceEngine(documentIndex);//service engine for working with indexes
var doc = new IndexDocument("ExternalId");//the document to be indexed and externalId
doc.Add("content".GetField(content)); // adding a new field: content
searchService.Index(new IndexDocument[]
{
doc// saving the document to the index
});
var parsed = query.Parse(field); // parsing the text and making a Boolean query
var request = new SearchQueryRequest() //
{
Query = parsed,
Field = field,
};
var result = searchService.Search(request); //
Result will be
You can use this nuget package Bsa.Search.Core but under .net core 3.1 or .net framework 472