Vim Practice
How to Customize your Own Error Type in Rust
Suppose you are writing a lexical analyzer(Lexer
), and you want return some customized errors while the lexer scan tokens,
and there are 3 possibel error will happens:
- Not Supported Tokens.
- Invalid Strings.
- Invalid Nums.
SO you can define the errors with a rust enum
:
pub enum LexerError {
InvalidToken(char),
InvalidString(String),
InvalidNum(String),
}
FullText Search Engine Componenets
What's the Core Components in a Full Text Search Engine
Look into Bleve Modern Search Lib Code, and Found that it has the following core components:
component | function of the component | |
---|---|---|
analysis | mainly contains analyzer(char filters, token filters, tokenizer) | |
cmd | command line client | |
document | define Document and Related Doc Fields(Text Field, Datetime Field, etc) | |
geo | Implement geo point and geo shape query | |
index | Analyze and read, write indexed fields to under key-value store | |
mapping | implment DocumentMapping: How the Document should be indexed. | |
search | Implment search functionality |
How a Full Text Search engine works - Index
Recently I am start working on build a Full Text Search engine with rust. But I don't know how to get started. And have many questions:
- What is the basic concept in the full-text search Engine.
- What are the core conponents in the Engine.
- And how they works together.
- How the document/text is analyzed and filtered,
- How the analyzed indexed is stored on the disk.
- How the engine searchs the results according user's query.
After Read about Elastic Search Docuemnts, Melisearch blogs, Couchbase blog, and read some source code from Bleve.
Comapre Rust with Golang
I have been using golang long time to wirte backend business logic.
After writing some rust code and I want do a comparison between golang and rust. This is maybe another good way to help you learn rust.
Build A Simple Interpreter with Rust part1
The first component of this interpreter is a Lexer which used for scan and group the chars into Tokens.
Build A Simple Interpreter with Rust Part0
What is Interpreter
From Wikipedia:
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interpreter generally uses one of the following strategies for program execution:
- Parse the source code and perform its behavior directly;
- Translate source code into some efficient intermediate representation or object code and immediately execute that;
- Explicitly execute stored precompiled bytecode made by a compiler and matched with the interpreter Virtual Machine.
First Blog Post
First Blog in buildwithrs.dev
Welcome
Buildwithrs.dev is the blog site that to record the process of building things from scratch with Rust Programming language.