elasthink

command module
v0.0.0-...-683a4be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

README

elasthink

GoDoc

An alternative to elasticsearch engine written in Go for small set of documents that uses inverted index to build the index and utilizes redis to store the indexes.

Table of Contents

Use Cases

  1. Create Index for a document (needs document_type, document_id, and document_name)
  2. Update Index of a document (needs document_type, document_id, and document_name)
  3. Search document_id by document name using search term (needs document_type and search_term)
  4. Keyword Suggestion by prefix (needs document_type and keyword_prefix)

Elasthink SDK

Coming Soon!
With the SDK, you can run all the core functionality of elasthink from your go service by providing a redis connection and without setting up a dedicated elasthink server.
Currently, the SDK is on preparation for the release. So stay tuned to get the latest update.

Installation

  1. To install elasthink, you need to run $ go get github.com/SurgicalSteel/elasthink
  2. Then you need to specify your redis addresses for each environment in files/config/redis folder
  3. To start with your own document, you need to modify the document type const in entity/document.go and its validation function in module/document.go
  4. To build elasthink, run $ go build
  5. To view all available flags, run $ ./elasthink -h
  6. To run elasthink, run $ ./elasthink -env={your-environment} -swr={stopword Removal option (true/false)} and your elasthink web service should run on localhost:9000

Documentation

API documentation (insomnia format) is available in the elasthink_insomnia_api_documentation.json. You can open it using Insomnia REST Client
For code documentation, we use standard godoc as our code documentation tool. To view the code documentation, follow these steps :

  1. Open your terminal, head to this cloned repo (SurgicalSteel/elasthink)
  2. run godoc -http=:6060 (this will trigger godoc at port 6060)
  3. Open your browser, and hit http://127.0.0.1:6060/pkg/github.com/SurgicalSteel/elasthink/

Dependencies

  1. gorilla/mux
  2. gomodule/redigo
  3. gcfg.v1
  4. stretchr/testify
  5. rafaeljusto/redigomock

Reference

E-Book Redis in Action Part 2 Chapter 7

Additional Note

Currently, elasthink supports stopwords removal option when doing tokenization for document name and search term. But, for now we only support stopwords removal for bahasa Indonesia (Indonesian).

Documentation

Overview

Package main is where all the magic happens ;)

Directories

Path Synopsis
Package config is where we parse configurations from configuration files (.ini) into configuration objects
Package config is where we parse configurations from configuration files (.ini) into configuration objects
Package entity is the package where we store and manage elasthink's core entity
Package entity is the package where we store and manage elasthink's core entity
Package module is the core package of elasthink
Package module is the core package of elasthink
Package redis is where we place all funcs related to redis operations
Package redis is where we place all funcs related to redis operations
Package router is the package where we define web routes on elasthink
Package router is the package where we define web routes on elasthink
package sdk provides the elasthink SDK which allows you to run all elasthink's core functionality in your service
package sdk provides the elasthink SDK which allows you to run all elasthink's core functionality in your service
Package service is where we handle every incoming services that are defined in router package
Package service is where we handle every incoming services that are defined in router package
Package util is where we place all utility funcs that can be used in every other packages
Package util is where we place all utility funcs that can be used in every other packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL