Skip to content

Commit

Permalink
Prepare for 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jvia committed Jan 19, 2024
1 parent fc72e4d commit 950b25d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.nytimes/querqy-clj "0.7.1-SNAPSHOT"
(defproject com.nytimes/querqy-clj "0.8.0-SNAPSHOT"
:description "Querqy in Clojure"
:url "https://github.com/nytimes/querqy-clj"

Expand Down
25 changes: 22 additions & 3 deletions src/com/nytimes/querqy/commonrules.clj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
(instance? DeleteInstruction obj))

(defn delete
"Delete text from a matched query. This is useful for removing unhelpful
search terms from the query."
[string]
(DeleteInstruction.
(parse-string string)
Expand All @@ -160,7 +162,12 @@
(instance? SynonymInstruction obj))

(defn synonym
"Create a synonym instruction."
"Create a synonym for the matched text.
```clojure
(match \"chickpeas\"
(synonym \"garbanzo beans\"))
```"
([string]
(synonym 1.0 string))
([boost string]
Expand All @@ -170,7 +177,14 @@
(description {:type "synonym", :param boost, :value string}))))

(defn boost
"Boost a matching term or query."
"Boost a matching term or query.
```clojure
;; Boost recipes which take less than 30 minutes when queries
;; match quick and recipe or recipes.
(match (and \"quick\" (or \"recipe\" \"recipes\")
(boost 10 {:range {:minutes {:lte 30}}}))
```"
[boost query]
(when (zero? boost)
(throw (IllegalArgumentException. "Cannot boost by 0")))
Expand All @@ -184,7 +198,12 @@
(description {:type "boost", :param boost, :value (pr-str query)}))))

(defn filter
"Add a filter to the query."
"Add a filter to the query. Filters require a match on documents.
```clojure
(match \"by paul krugman\"
(filter {:term {:author \"Paul Krugman\"}}))
```"
[query]
(FilterInstruction.
(parse-query query)
Expand Down

0 comments on commit 950b25d

Please sign in to comment.