City Nodes :- Pune, Mumbai, Kolkata, Chennai, Puri, Puneri
case insensitive Reads :-
Partial search read >> contains 2 or more characters anywhere
eg:- Pu
Expected results :- Pune, Puri, Puneri
eg:- ai
Expected results :- Mumbai, Chennai
Exact read >> equals name of the node
eg:- pune
Expected result :- Pune
What schema should i use to define these nodes and how to read both cases?
Case-insensitive, partial word, and (case-insensitive) exact matches can be done with the regular expression trigram string index. See the “Indexing” section of the docs for more info: https://docs.dgraph.io/query-language/#indexing
The example you gave is case-insensitive exact match. There’s the exact string index, but that doesn’t satisfy your case-insensitive requirement. You could store your values in a normalized form like all lowercase. If you did that, then you could use exact.