This weekend I was trying to accomplish full-text search in SQLite using Honey SQL. Explicitly executing the query from jdbc works as I hoped:
(jdbc/execute! ["SELECT * FROM documents WHERE text MATCH ?" "moose"])`
When I attempt the same query with Honey SQL, I can’t quite match the expression:
(sql/format {:select :* :from :documents :where [:match :text "moose"]})
=> ["SELECT * FROM documents WHERE MATCH(text, ?)" "moose"]
Any ideas? Thanks.Is there no non-global option for this in honeysql?
No, it's a very simple lookup of a value in a map in an atom.
:match is not registered as an infix operator, so by default it's treated as a function.
You can use (honey.sql/register-op! :match) to fix it.
But note that if there is a match function, doing that will prevent you from using it.
Thanks!