Skip to content

Commit

Permalink
Merge pull request #276 from saidone75/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
saidone75 authored May 28, 2024
2 parents fdc23e4 + d5a8705 commit 192d75c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ ACS_VERSION=23.2.1
SHARE_IMAGE=alfresco/alfresco-share
SHARE_VERSION=23.2.1
ASS_IMAGE=alfresco/alfresco-search-services
ASS_VERSION=2.0.9.1
ASS_VERSION=2.0.10
ACTIVEMQ_IMAGE=alfresco/alfresco-activemq
ACTIVEMQ_VERSION=5.18-jre17-rockylinux8
20 changes: 20 additions & 0 deletions src/cral/api/core/queries.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
(:import (clojure.lang PersistentHashMap)
(cral.model.auth Ticket)
(cral.model.core FindNodesQueryParams
FindPeopleQueryParams
FindSitesQueryParams)))

(defn find-nodes
Expand Down Expand Up @@ -65,4 +66,23 @@
(format "%s/queries/sites" (config/get-url 'core))
ticket
{:query-params query-params}
opts))

(defn find-people
"Gets a list of people that match the given search criteria.
The search term is used to look for matches against person id, firstname and lastname.
The search term:
- must contain a minimum of 2 alphanumeric characters
- can optionally use '*' for wildcard matching within the term\n\n
You can sort the result list using the **order-by** parameter. You can specify one or more of the following fields in the **order-by** parameter:
- id
- firstName
- lastName\n\n
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API#/queries/findPeople)."
[^Ticket ticket ^FindPeopleQueryParams query-params & [^PersistentHashMap opts]]
(utils/call-rest
client/get
(format "%s/queries/people" (config/get-url 'core))
ticket
{:query-params query-params}
opts))
4 changes: 2 additions & 2 deletions src/cral/api/search.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
[cral.utils.utils :as utils])
(:import (clojure.lang PersistentHashMap)
(cral.model.auth Ticket)
(cral.model.search SearchBody)))
(cral.model.search QueryBody)))

(defn search
"Searches Alfresco"
[^Ticket ticket ^SearchBody search-request & [^PersistentHashMap opts]]
[^Ticket ticket ^QueryBody search-request & [^PersistentHashMap opts]]
(utils/call-rest
client/post
(format "%s/search" (config/get-url 'search))
Expand Down
7 changes: 7 additions & 0 deletions src/cral/model/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@
^PersistentVector order-by
^PersistentVector fields])

(defrecord FindPeopleQueryParams
[^String term
^Integer skip-count
^Integer max-items
^PersistentVector fields
^PersistentVector order-by])

;; ratings
(defrecord ListRatingsQueryParams
[^Integer skip-count
Expand Down
26 changes: 22 additions & 4 deletions src/cral/model/search.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,26 @@
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns cral.model.search)
(ns cral.model.search
(:import (clojure.lang PersistentVector)))

(defrecord RequestQuery [^String language ^String user-query ^String query])
(defrecord Paging [^Integer max-items ^Integer skip-count])
(defrecord SearchBody [^RequestQuery query ^Paging paging])
(defrecord RequestQuery
[^String language
^String user-query
^String query])

(defrecord Paging
[^Integer max-items
^Integer skip-count])

(defrecord Sort
[^String type
^String field
^Boolean ascending])

(defrecord QueryBody
[^RequestQuery query
^Paging paging
^PersistentVector include
^PersistentVector fields
^PersistentVector sort])
2 changes: 1 addition & 1 deletion test/cral/search_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])
response
(->> (search-model/map->RequestQuery {:query "PATH:'app:company_home'"})
(#(search-model/map->SearchBody {:query %}))
(#(search-model/map->QueryBody {:query %}))
(#(search/search ticket %)))]
(is (= (:status response) 200))
(is (= (get-in (first (get-in response [:body :list :entries])) [:entry :name]) "Company Home"))))

0 comments on commit 192d75c

Please sign in to comment.