You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+37-31Lines changed: 37 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,9 +111,36 @@ Environment variables control implementation selection:
111
111
- Integration tests can switch between real and mock implementations
112
112
- Test files follow `*_test.go` pattern alongside implementation files
113
113
114
-
<<<<<<< HEAD
115
114
## API Features
116
115
116
+
### Page Size
117
+
118
+
The `query-resources` endpoint supports a `page_size` query parameter to control how many documents are returned per page.
119
+
120
+
**Query Parameter:**
121
+
122
+
-`page_size` (int, optional): Number of results per page (min: 1, max: 1000, default: 50)
123
+
124
+
**Examples:**
125
+
126
+
```bash
127
+
# Custom page size
128
+
GET /query/resources?v=1&type=project&page_size=20
129
+
130
+
# Combined with other filters
131
+
GET /query/resources?v=1&type=project&tags=active&date_field=updated_at&date_from=2025-01-01&page_size=100
132
+
```
133
+
134
+
**Interaction with post-query filters:**`cel_filter` and access control checks are applied after OpenSearch returns results, so a page may return fewer than `page_size` results.
The query service supports filtering resources by date ranges on fields within the `data` object.
@@ -154,17 +181,13 @@ GET /query/resources?v=1&type=project&tags=active&date_field=updated_at&date_fro
154
181
- OpenSearch query: `internal/infrastructure/opensearch/template.go` (range query with gte/lte)
155
182
- API design: `design/query-svc.go` (Goa design specification)
156
183
- Test coverage: `cmd/service/converters_test.go` (17 comprehensive test cases)
157
-
=======
158
-
## CEL Filter Feature
159
184
160
-
The service supports Common Expression Language (CEL) filtering for post-query resource filtering.
185
+
### CEL Filter
161
186
162
-
### Overview
187
+
The service supports Common Expression Language (CEL) filtering for post-query resource filtering.
163
188
164
189
CEL filtering allows API consumers to filter resources on arbitrary data fields using a safe, non-Turing complete expression language. The filter is applied after the OpenSearch query but before access control checks.
@@ -217,14 +224,13 @@ service := service.NewResourceSearch(mockSearcher, mockAccessChecker, mockFilter
217
224
- List membership: `data.category in ["security", "networking"]`
218
225
- Field existence: `has(data.archived)`
219
226
220
-
### Performance Considerations
227
+
**Performance Considerations:**
221
228
222
229
- Compiled CEL programs are cached (100 max entries, 5-minute TTL)
223
230
- Each resource evaluation has 100ms timeout
224
231
- Post-query filtering means pagination may return fewer results than page size
225
232
- For best performance, use specific OpenSearch criteria first, then CEL for refinement
226
233
227
-
### Important Limitations
234
+
**Important Limitations:**
228
235
229
-
**Pagination**: CEL filters apply only to results from each OpenSearch page. If the target resource is not in the first page of OpenSearch results, it won't be found even if it matches the CEL filter. Always use specific primary search criteria (`type`, `name`, `parent`) to narrow OpenSearch results first.
230
-
>>>>>>> 3e45fc4d33aba656a5abe1c3df0d3f2bd0fd6be7
236
+
CEL filters apply only to results from each OpenSearch page. If the target resource is not in the first page of OpenSearch results, it won't be found even if it matches the CEL filter. Always use specific primary search criteria (`type`, `name`, `parent`) to narrow OpenSearch results first.
0 commit comments