Skip to content

Commit f8a00c0

Browse files
authored
feat: Allow searching solr by user defined queries (#738)
- Adds a new endpoint to query solr for renku entities - The api is copied from the previous (scala) services - Results are filtered based on authz using the relation `non_public_read`
1 parent 25267f7 commit f8a00c0

36 files changed

+3900
-163
lines changed

.devcontainer/docker-compose.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
data_service:
53
image: "mcr.microsoft.com/devcontainers/python:3.13-bookworm"
@@ -26,12 +24,13 @@ services:
2624
NB_SERVER_OPTIONS__DEFAULTS_PATH: /workspace/server_defaults.json
2725
NB_SERVER_OPTIONS__UI_CHOICES_PATH: /workspace/server_options.json
2826
KUBECONFIG: "/workspace/.k3d-config.yaml"
29-
SOLR_URL: "http://127.0.0.1:8983"
27+
SOLR_URL: "http://localhost:8983"
3028
SOLR_CORE: "renku-search-dev"
3129
network_mode: service:db
3230
depends_on:
3331
- db
3432
- authz
33+
- solr
3534

3635
db:
3736
image: postgres:latest
@@ -45,13 +44,18 @@ services:
4544
POSTGRES_USER: renku
4645
POSTGRES_DB: postgres
4746
POSTGRES_PASSWORD: renku
47+
# All services is put into the network of this service, so
48+
# everything is reachable via localhost. This is necessary,
49+
# because authzed doesn't allow insecure connections from anything
50+
# other than localhost….
4851
ports:
49-
- "8000:8000"
50-
- "5432:5432"
51-
- "8080:8080"
52-
- "5678:5678"
53-
- "50051:50051"
52+
- "8000:8000" # data-service api
53+
- "5432:5432" # postgresql
54+
- "8080:8080" # swagger
55+
- "5678:5678" # python debugger (data_service)
56+
- "50051:50051" # authzed grpc
5457
- "8888:80"
58+
- "8983:8983" # solr
5559

5660
swagger:
5761
image: swaggerapi/swagger-ui
@@ -75,6 +79,7 @@ services:
7579
solr:
7680
image: solr:9
7781
restart: unless-stopped
82+
network_mode: service:db
7883
volumes:
7984
- solr_data:/var/solr
8085
command:

components/renku_data_services/search/api.spec.yaml

Lines changed: 303 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,54 @@ info:
88
servers:
99
- url: /api/data
1010
paths:
11+
/search/query:
12+
get:
13+
summary: Run a search query.
14+
parameters:
15+
- in: query
16+
description: query parameters
17+
name: params
18+
style: form
19+
explode: true
20+
schema:
21+
$ref: "#/components/schemas/SearchQuery"
22+
responses:
23+
"422":
24+
description: Failed to validate the query parameters
25+
"500":
26+
description: Internal server error.
27+
"503":
28+
description: Temporary internal error.
29+
"200":
30+
description: Search results according to the query.
31+
#NOTE: This is not the standard way we do pagination, but to
32+
#be compatible witht the current search API we make an
33+
#exception for the search here
34+
headers:
35+
x-page:
36+
required: true
37+
schema:
38+
type: integer
39+
format: int32
40+
x-per-page:
41+
required: true
42+
schema:
43+
type: integer
44+
format: int32
45+
x-total:
46+
required: true
47+
schema:
48+
type: integer
49+
format: int64
50+
x-total-pages:
51+
required: true
52+
schema:
53+
type: integer
54+
format: int32
55+
content:
56+
application/json:
57+
schema:
58+
$ref: "#/components/schemas/SearchResult"
1159
/search/reprovision:
1260
post:
1361
summary: Start a new reprovisioning
@@ -56,6 +104,261 @@ paths:
56104

57105
components:
58106
schemas:
107+
SearchQuery:
108+
description: Query params for the search request
109+
allOf:
110+
- $ref: "#/components/schemas/PaginationRequest"
111+
- properties:
112+
q:
113+
description: The search query.
114+
type: string
115+
default: ""
116+
PaginationRequest:
117+
type: object
118+
additionalProperties: false
119+
properties:
120+
page:
121+
description: Result's page number starting from 1
122+
type: integer
123+
minimum: 1
124+
default: 1
125+
per_page:
126+
description: The number of results per page
127+
type: integer
128+
minimum: 1
129+
maximum: 100
130+
default: 20
131+
FacetData:
132+
title: FacetData
133+
examples:
134+
- entityType:
135+
Project: 15
136+
User: 3
137+
type: object
138+
required:
139+
- entityType
140+
properties:
141+
entityType:
142+
$ref: '#/components/schemas/Map_EntityType_Int'
143+
Group:
144+
title: Group
145+
examples:
146+
- type: Group
147+
id: 2CAF4C73F50D4514A041C9EDDB025A36
148+
name: SDSC
149+
namespace: SDSC
150+
description: SDSC group
151+
score: 1.1
152+
type: object
153+
required:
154+
- id
155+
- name
156+
- namespace
157+
- type
158+
properties:
159+
id:
160+
type: string
161+
name:
162+
type: string
163+
namespace:
164+
type: string
165+
description:
166+
type: string
167+
score:
168+
type: number
169+
format: double
170+
type:
171+
type: string
172+
const: Group
173+
Map_EntityType_Int:
174+
title: Map_EntityType_Int
175+
type: object
176+
additionalProperties:
177+
type: integer
178+
format: int32
179+
PageDef:
180+
title: PageDef
181+
type: object
182+
required:
183+
- limit
184+
- offset
185+
properties:
186+
limit:
187+
type: integer
188+
format: int32
189+
offset:
190+
type: integer
191+
format: int32
192+
PageWithTotals:
193+
title: PageWithTotals
194+
type: object
195+
required:
196+
- page
197+
- totalResult
198+
- totalPages
199+
properties:
200+
page:
201+
$ref: '#/components/schemas/PageDef'
202+
totalResult:
203+
type: integer
204+
format: int64
205+
totalPages:
206+
type: integer
207+
format: int32
208+
prevPage:
209+
type: integer
210+
format: int32
211+
nextPage:
212+
type: integer
213+
format: int32
214+
SearchProject:
215+
title: Project
216+
examples:
217+
- type: Project
218+
id: 01HRA7AZ2Q234CDQWGA052F8MK
219+
name: renku
220+
slug: renku
221+
namespace:
222+
type: Group
223+
id: 2CAF4C73F50D4514A041C9EDDB025A36
224+
name: SDSC
225+
namespace: SDSC
226+
description: SDSC group
227+
score: 1.1
228+
repositories:
229+
- https://github.com/renku
230+
visibility: public
231+
description: Renku project
232+
createdBy:
233+
type: User
234+
id: 1CAF4C73F50D4514A041C9EDDB025A36
235+
namespace: renku/renku
236+
firstName: Albert
237+
lastName: Einstein
238+
score: 2.1
239+
creationDate: '2025-03-06T15:05:42.058323392Z'
240+
keywords:
241+
- data
242+
- science
243+
score: 1
244+
type: object
245+
required:
246+
- id
247+
- name
248+
- slug
249+
- visibility
250+
- creationDate
251+
- type
252+
properties:
253+
id:
254+
type: string
255+
name:
256+
type: string
257+
slug:
258+
type: string
259+
namespace:
260+
$ref: '#/components/schemas/UserOrGroup'
261+
repositories:
262+
type: array
263+
items:
264+
type: string
265+
visibility:
266+
$ref: '#/components/schemas/Visibility'
267+
description:
268+
type: string
269+
createdBy:
270+
$ref: '#/components/schemas/User'
271+
creationDate:
272+
type: string
273+
format: date-time
274+
keywords:
275+
type: array
276+
items:
277+
type: string
278+
score:
279+
type: number
280+
format: double
281+
type:
282+
type: string
283+
const: Project
284+
SearchEntity:
285+
title: SearchEntity
286+
oneOf:
287+
- $ref: '#/components/schemas/Group'
288+
- $ref: '#/components/schemas/SearchProject'
289+
- $ref: '#/components/schemas/User'
290+
discriminator:
291+
propertyName: type
292+
mapping:
293+
Group: '#/components/schemas/Group'
294+
Project: '#/components/schemas/SearchProject'
295+
User: '#/components/schemas/User'
296+
SearchResult:
297+
title: SearchResult
298+
type: object
299+
required:
300+
- facets
301+
- pagingInfo
302+
properties:
303+
items:
304+
type: array
305+
items:
306+
$ref: '#/components/schemas/SearchEntity'
307+
facets:
308+
$ref: '#/components/schemas/FacetData'
309+
pagingInfo:
310+
$ref: '#/components/schemas/PageWithTotals'
311+
User:
312+
title: User
313+
examples:
314+
- type: User
315+
id: 1CAF4C73F50D4514A041C9EDDB025A36
316+
namespace: renku/renku
317+
firstName: Albert
318+
lastName: Einstein
319+
score: 2.1
320+
type: object
321+
required:
322+
- id
323+
- type
324+
properties:
325+
id:
326+
type: string
327+
namespace:
328+
type: string
329+
firstName:
330+
type: string
331+
lastName:
332+
type: string
333+
score:
334+
type: number
335+
format: double
336+
type:
337+
type: string
338+
const: User
339+
UserOrGroup:
340+
title: UserOrGroup
341+
examples:
342+
- type: Group
343+
id: 2CAF4C73F50D4514A041C9EDDB025A36
344+
name: SDSC
345+
namespace: SDSC
346+
description: SDSC group
347+
score: 1.1
348+
oneOf:
349+
- $ref: '#/components/schemas/Group'
350+
- $ref: '#/components/schemas/User'
351+
discriminator:
352+
propertyName: type
353+
mapping:
354+
Group: '#/components/schemas/Group'
355+
User: '#/components/schemas/User'
356+
Visibility:
357+
description: Project's visibility levels
358+
type: string
359+
enum:
360+
- private
361+
- public
59362
Reprovisioning:
60363
description: A reprovisioning
61364
type: object

0 commit comments

Comments
 (0)