https://github.com/micheleriva/gosearch
In-memory, full-text search engine built in Go. For no particular reason.
https://github.com/micheleriva/gosearch
Last synced: 5 months ago
JSON representation
In-memory, full-text search engine built in Go. For no particular reason.
- Host: GitHub
- URL: https://github.com/micheleriva/gosearch
- Owner: micheleriva
- License: mit
- Created: 2021-11-19T20:15:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-28T16:09:21.000Z (almost 4 years ago)
- Last Synced: 2025-04-30T21:49:21.951Z (5 months ago)
- Language: Go
- Size: 172 KB
- Stars: 30
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README

## Motivation
I just wanted to learn how to write a search engine from scratch without any prior experience.
## Features
- [x] Index content
- [x] Search content
- [x] Index content REST API
- [x] Search content REST API
- [x] Delete content
- [x] Delete content REST API
- [X] Update content
- [X] Update content REST API## REST API
**Index a new document:**
`curl -X POST http://localhost:8080/v1/insert -d "{\"content\": \"lorem ipsum\"}"`**Search through all documents:**
`curl -X GET http://localhost:8080/v1/search?q=lorem`## Golang API
First install the package via Go Mod:
```
go get github.com/micheleriva/gosearch
```Then you can use its native Golang APIs to index and search for documents:
```go
package mainimport (
"fmt"
"github.com/micheleriva/gosearch"
)func main() {
gosearch.IndexDocument("Love is old, love is new, love is all, love is you")
gosearch.IndexDocument("What is love? Baby don't hurt me, no more.")
results := gosearch.Search("love")
fmt.Println(results)
// => ["Love is old, love is new, love is all, love is you", "What is love? Baby don't hurt me, no more."]
}
```# License
gosearch is licensed under the [MIT](/LICENSE.md) license, but seriosuly, don't use it. Or do it at your own risk.