// FindRelativeValues finds all relative values against to the input `key`.
// It returns the result of (FindByPrefix + FindMatchingPrefix + FindByFuzzy)
FindRelativeValues finds all relative values against to the input `key`.
It returns the result of (FindByPrefix + FindMatchingPrefix + FindByFuzzy)
// FindRelativeValues finds all relative values against to the input ` key ` . // It returns the result of ( FindByPrefix + FindMatchingPrefix + FindByFuzzy )
func (t *Trie) FindRelativeValues(key string) []interface{} {
	t.mu.RLock()
	defer t.mu.RUnlock()
	m := map[string]interface{}{}
	node := findNode(t.root, []rune(key))
	if node != nil {
		m = collectAll(node)
	}
	nodes, ok := t.findPrefixMatchNodes(key)
	if ok {
		for _, n := range nodes {
			m[n.path] = n.value
		}
	}
	keys := t.FindByFuzzy(key)
	for i := range keys {
		m[keys[i]], _ = t.Find(key)
	}
	values := make([]interface{}, 0, len(m))
	for k := range m {
		values = append(values, k)
	}
	return values
}
func ( t * Trie ) FindRelativeValues ( key string ) [ ] interface { } { t . mu . RLock ( ) defer t . mu . RUnlock ( ) m := map [ string ] interface { } { } node := findNode ( t . root , [ ] rune ( key ) ) if node != nil { m = collectAll ( node ) } nodes , ok := t . findPrefixMatchNodes ( key ) if ok { for _ , n := range nodes { m [ n . path ] = n . value } } keys := t . FindByFuzzy ( key ) for i := range keys { m [ keys [ i ] ] , _ = t . Find ( key ) } values := make ( [ ] interface { } , 0 , len ( m ) ) for k := range m { values = append ( values , k ) } return values }
FindRelativeValues finds all relative values against to the input `key`.
FindRelativeValues finds all relative values against to the input ` key ` .