In FQL v10, how can we search collections by prefix substring? For instance, if I input the string 'john', it should return all mentioned data with that prefix. What should the index creation and query process look like? I’ve only found discussions and examples using v4.
With Computed Fields you can calculate values that can be indexed on, other than the fields persisted in the documents.
For example
collection Customer {
// create an array of whole words to match
compute nameSearch: Array<String> = (
doc => doc.name.casefold().split(" ")
)
// an index that can match any items in the calculated `nameSearch` field
index nameSearch {
terms [mva(.nameSearch)]
}
}