Giter Club home page Giter Club logo

dotnetcoresample's Introduction

Coresearch

coresearch

.NET Core cross-platform, in-memory, full text search library for building search engines

About

Coresearch uses an inverted index with a boosted trie data structure for indexing atomic search criterion from content to resources. Trie algorithm makes Coresearch more elastic and allows both exact word querying and operations like fuzzy search, wildcards and character matching. Entire trie structure is stored in memory for better performance. The entire project was written as a learning project so be aware of putting in on the production ๐Ÿ˜‰

Trie

Features

  • Efficient inverted index algorithm (mapping from content to resources)
  • Uses Prefix Tree (Trie) data structure for quick search and horizontal scaling
  • Exact search with super fast O(k) worst case time, where k is the key length
  • Wildcard search for recursive depth-first search tree traversal
  • Character match search with deep level k+1
  • Simple command line tool and library
  • Cross-platform, runs on Linux, MacOS and Windows
  • Easily handle large amount of different resources

Trie

Trie on Wikipedia

Trie

CLI commands

Load data from files in specific path and extension (recursive)

source <string path> <string extension>
alias: load

example:

> source ./ *.txt

Get resource names for exact key (word)

get <string key>
alias: search

example:

> search cars
output:
<resource names for key cars>

Search for every resource name which key starts with prefix

Query modes:

  • Question mark (?) is for select of all resource names belong to children of specific node (if any).
  • Wildcard sign (*) is for select of all resource names recursively under specific prefix.
  • Exact matching (without any sign) produces equal output as get/search command.
query <string prefix> <query mode: . or *>

example 1:

> query c ?
output: 
<resource names for keys: ca, cb, c5, co, c1, ...>

example 2:

> query c *
output: 
<resource names for keys: ca, cabbage, c4a541, cars, cardio, cantaloupe, ...>

example 3:

> query cars
output: 
<resource names for key cars>

Add resource under key (word)

add <string resource name> <string content>
alias: insert

example:

> add english-dict.txt house 

Remove specific key (word)

delete <string key>

example:

> delete sport

Echo

echo <string content>

example:

> echo hello
output:
hello

Turn on/off debug mode

debug <bool>

example:

> debug true

Remove every node in structure and collect memory

flush

example:

> flush

Show information

info

example:

> flush
output:
Nodes in trie: 4651175
Words inserted: 15513389
Resource files: 2227
Memory usage: 1044944640 bytes

Clear console

clear

example:

> clear

CLI arguments

Turn debug mode

--debug <bool>
-d

Set max size of memory (in bytes)

--memory-limit <int>
-m

Pre-process every word before insert

--normalize <bool>
-n

Pattern for removing unwanted characters, used for each word before insert

--pattern <regex>
-p

Load data from specific path at start

--source <string>
-s

Set extension for loading data at start

--extension <string>
-e

License

coresearch is licensed under the MIT.

dotnetcoresample's People

Contributors

pilotpirxie avatar kppriyajai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.