Skip to content
/ busca Public

A minimal full text search engine developed in Go

License

Notifications You must be signed in to change notification settings

ruial/busca

Repository files navigation

Busca

A minimal full text search engine developed in Go.

Features

  • RESTful API
  • In-memory index with snapshot persistence
  • Stop words and synonyms
  • Snowball stemmer
  • Multiple fast tokenizers
  • tf-idf ranking with customizable weighting schemes
  • Spell checking suggestions
  • Cross platform and lightweight
  • Observability with Prometheus metrics

Usage

Check the docs for API examples and my blog for more information about this project. To get started:

# API
docker-compose up
make bootstrap
curl -X POST http://localhost:8080/indexes/test-index/_search \
  -H 'content-type: application/json' \
  -d '{"query": "Alice dream adventures crime detective","filter": "or","tf_weight": "log","idf_weight": "smooth","include_text": false,"top": 3}'

# Library
# go get github.com/ruial/busca
idx := index.New(index.Opts{Analyzer: analysis.WhitespaceAnalyzer{}})
idx.AddDocument(core.NewBaseDocument("doc1", "some text"))
idx.AddDocument(core.NewBaseDocument("doc2", "even more text"))
ranker := search.TfIdfRanker(search.TfWeightLog, search.IdfWeightSmooth)
results := idx.SearchDocuments("more text", search.OrFilter, ranker)
fmt.Println(results)

About

A minimal full text search engine developed in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published