2 ms·
The query that I have working is an abomination (it works though, https://github.com/Koeng101/poly/blob/polyStore_v0.1/store/construct.go#L244-L332 https://gith
by koeng 6y ago
The query that I have working is an abomination (it works though, https://github.com/Koeng101/poly/blob/polyStore_v0.1/store/construct.go#L244-L332 https://github.com/Koeng101/poly/blob/polyStore_v0.1/store/c...)
The basic idea is that I am using SQL to back a suffix array (https://en.wikipedia.org/wiki/Suffix_array https://en.wikipedia.org/wiki/Suffix_array). The suffix array has all suffixes of a string (for "bats", it would have ["bat", "at", "t"] sorted in alphabetical order ["at", "bat", "t"] except storing the index of the suffix [1, 0, 2].
To search for a string, you go halfway in the suffix array and check if the suffix is lexicographically equal to, larger than, or smaller than your input. If it is not equal to, halve in the right direction. If the string is there, eventually you'll hit it.