This is something that is possible, but with a combination of 2 inequality filters.
Let's say you want to list Places
that have the "li"
prefix. This can be described with a query that lists Places
that are greater than (or equal to) "li"
and less than a prefix that is the next string after "li"
in lexicographical order: "lj"
.
This is how the GQL looks like:
SELECT * FROM Places WHERE Name > 'li' AND Name < 'lj'
Coded in Go it looks like this:
q = datastore.NewQuery("Places").Filter("Name >", "li").Filter("Name <", "lj")
This will list Places
where name is for example:
liam
lisotto
lizst
But will exclude names like:
abc
ljoi
lj
qwerty
One thing to note: small and capital letters are different in lexicographical order, so for example "List"
is less than "li"
(even though "list"
is greater than "li"
)!