Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tahmid-saj/search-service

Typeahead search service using a Trie data structure approach. Developed using Go / Gin and AWS DynamoDB.
https://github.com/tahmid-saj/search-service

dynamodb gin go trie typeahead-search

Last synced: 15 days ago
JSON representation

Typeahead search service using a Trie data structure approach. Developed using Go / Gin and AWS DynamoDB.

Awesome Lists containing this project

README

        

# search-service

Typeahead search service using a Trie data structure approach. Developed using Go / Gin and AWS DynamoDB.




## Directory structure

The directory structure is as follows:

- **dynamodb/**: Contains DynamoDB-specific configurations and utilities for managing the trie structure in the database.
- **models/**: Defines the data models used in the application, including Trie-related entities.
- **routes/**: Manages the API routes for handling search requests.
- **trie/**: Implements the Trie data structure logic for the typeahead search.
- **utils/**: General utility functions used across the application.
- **.gitignore**: Specifies files and directories to ignore in Git.
- **README.md**: Documentation for the project setup and usage.
- **go.mod**: Go module dependencies.
- **go.sum**: Checksum of Go module dependencies.
- **main.go**: Entry point of the application, where the server is initialized.




## Overview

### Design

The search operation of the service uses the trie nodes (stored in DynamoDB) to efficiently find the top frequent searches for a prefix. Similar services can be found here and below:

#### Similar services

image

### Examples

#### Sample trie table in AWS DynamoDB

image

#### API input and output when searching

```
// Input
{
"searchQuery": "alg",
"tableName": "search-service-trie"
}
```

```
// Output
{

"ok": true,
"response": [
{
"Result": "algorithms",
"ResultFrequency": 2
},
{
"Result": "alg",
"ResultFrequency": 3
},
{
"Result": "algorit",
"ResultFrequency": 1
},
{
"Result": "algo",
"ResultFrequency": 2
}
]
}
```