SkillAgentSearch skills...

Searchindex

In-memory search index by strings (suffix trie)

Install / Use

/learn @twelvedata/Searchindex
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

In-memory search index

Features

  • Indexation using simple tree
  • Search by beginning of string
  • Exact search
  • Suitable for non-long strings

More about in article on Medium

How to use

package main

import (
    "fmt"
    "github.com/twelvedata/searchindex"
)

type SymbolInfo struct {
    Symbol     string
    Exchange   string
    Instrument string
}

func main() {
    // Values for indexation
    searchList := searchindex.SearchList{
        &searchindex.SearchItem{
            Key: "AAPL",
            Data: &SymbolInfo{Symbol: "AAPL", Exchange: "NASDAQ", Instrument: "Apple Inc"},
        },
        &searchindex.SearchItem{
            Key: "AMZN",
            Data: &SymbolInfo{Symbol: "AMZN", Exchange: "NASDAQ", Instrument: "Amazon.com Inc"},
        },
    }

    // Fill index
    searchIndex := searchindex.NewSearchIndex(searchList, 10, nil, nil, true, nil)

    // Search
    result := searchIndex.Search(searchindex.SearchParams{
        Text: "aa",
        OutputSize: 10,
        Matching: searchindex.Beginning,
    })

    fmt.Println(result[0])
}

Run tests:

make test
View on GitHub
GitHub Stars30
CategoryDevelopment
Updated5mo ago
Forks5

Languages

Go

Security Score

77/100

Audited on Oct 26, 2025

No findings