Created
December 20, 2021 21:51
-
-
Save jvia/564f40d87b8d41e409d6d936ade1f345 to your computer and use it in GitHub Desktop.
querqy clojure example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; define a rule base | |
(defrules rules | |
(match "personal computer" | |
(synonym "pc") | |
(synonym "desktop computer") | |
(down 50 "software")) | |
(match "sofa*" | |
(synonym "sofa *1"))) | |
;; take the query "sofabed" and generate an ES query | |
;; based on the rule base | |
(-> (rewrite rules "sofabed") | |
(emit-query {:default-field :textAll})) | |
{:bool | |
{:should [{:match {:textAll "sofabed"}} | |
{:match {:textAll "sofa bed"}}]}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment