I want to compose a query that takes a firstname as input parameter and returns all matching records. A match should be case insensitive. As an example I'd like to extract all the people named Douglass. Parameterized, but case sensitive this would be :
(d/q '[:find (pull ?e [*])
:in $ ?par
:where
[?e :person/firstname ?par]
] db "Douglass")
The following query will yield all matches regardless the case, but is not parameterized (the ?par is not used yet, but a placeholder for the parameterized query) :
(d/q '[:find (pull ?e [*])
:in $ ?par
:where
[?e :person/firstname ?bfn]
[(re-find (re-pattern "(?i)DouGLASS") ?bfn)]
] db "")
But I'm not able to combine them. A - probably naive - approach is throwing Unable to resolve symbol: ?par in this context
:
(d/q '[:find (pull ?e [*])
:in $ ?par
:where
[?e :person/firstname ?bfn]
[ (re-find (re-pattern (str "(?i)" ?par)) ?bfn)]
] db "Douglass")
So : how to pass the firstname for this case?