Skip to content

Commit 3d39b36

Browse files
committed
progress
1 parent 2868666 commit 3d39b36

File tree

2 files changed

+212
-2
lines changed

2 files changed

+212
-2
lines changed

generators/src/main/java/com/algolia/codegen/cts/lambda/EscapeQuotesLambda.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class EscapeQuotesLambda implements Mustache.Lambda {
1010
@Override
1111
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
1212
String text = fragment.execute();
13-
writer.write(text.replace("\"", "\\\""));
13+
// replaces all occurrences of " that are not preceded by a backslash with \"
14+
writer.write(text.replaceAll("(?<!\\\\)\"", "\\\\\""));
1415
}
1516
}

tests/CTS/requests/search/searchSingleIndex.json

Lines changed: 210 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
}
129129
},
130130
{
131-
"testName": "withFilters",
131+
"testName": "filters",
132132
"isSnippet": true,
133133
"parameters": {
134134
"indexName": "indexName",
@@ -143,5 +143,214 @@
143143
"filters": "country:US AND price.gross < 2.0"
144144
}
145145
}
146+
},
147+
{
148+
"testName": "distinct",
149+
"isSnippet": true,
150+
"parameters": {
151+
"indexName": "indexName",
152+
"searchParams": {
153+
"distinct": true
154+
}
155+
},
156+
"request": {
157+
"path": "/1/indexes/indexName/query",
158+
"method": "POST",
159+
"body": {
160+
"distinct": true
161+
}
162+
}
163+
},
164+
{
165+
"testName": "filtersNumeric",
166+
"isSnippet": true,
167+
"parameters": {
168+
"indexName": "indexName",
169+
"searchParams": {
170+
"filters": "price < 10"
171+
}
172+
},
173+
"request": {
174+
"path": "/1/indexes/indexName/query",
175+
"method": "POST",
176+
"body": {
177+
"filters": "price < 10"
178+
}
179+
}
180+
},
181+
{
182+
"testName": "filtersTimestamp",
183+
"isSnippet": true,
184+
"parameters": {
185+
"indexName": "indexName",
186+
"searchParams": {
187+
"filters": "NOT date_timestamp:1514764800 TO 1546300799"
188+
}
189+
},
190+
"request": {
191+
"path": "/1/indexes/indexName/query",
192+
"method": "POST",
193+
"body": {
194+
"filters": "NOT date_timestamp:1514764800 TO 1546300799"
195+
}
196+
}
197+
},
198+
{
199+
"testName": "filtersSumOrFiltersScoresFalse",
200+
"isSnippet": true,
201+
"parameters": {
202+
"indexName": "indexName",
203+
"searchParams": {
204+
"filters": "(company:Google<score=3> OR company:Amazon<score=2> OR company:Facebook<score=1>)",
205+
"sumOrFiltersScores": false
206+
}
207+
},
208+
"request": {
209+
"path": "/1/indexes/indexName/query",
210+
"method": "POST",
211+
"body": {
212+
"filters": "(company:Google<score=3> OR company:Amazon<score=2> OR company:Facebook<score=1>)",
213+
"sumOrFiltersScores": false
214+
}
215+
}
216+
},
217+
{
218+
"testName": "filtersSumOrFiltersScoresTrue",
219+
"isSnippet": true,
220+
"parameters": {
221+
"indexName": "indexName",
222+
"searchParams": {
223+
"filters": "(company:Google<score=3> OR company:Amazon<score=2> OR company:Facebook<score=1>)",
224+
"sumOrFiltersScores": true
225+
}
226+
},
227+
"request": {
228+
"path": "/1/indexes/indexName/query",
229+
"method": "POST",
230+
"body": {
231+
"filters": "(company:Google<score=3> OR company:Amazon<score=2> OR company:Facebook<score=1>)",
232+
"sumOrFiltersScores": true
233+
}
234+
}
235+
},
236+
{
237+
"testName": "filtersStephenKing",
238+
"isSnippet": true,
239+
"parameters": {
240+
"indexName": "indexName",
241+
"searchParams": {
242+
"filters": "author:\"Stephen King\""
243+
}
244+
},
245+
"request": {
246+
"path": "/1/indexes/indexName/query",
247+
"method": "POST",
248+
"body": {
249+
"filters": "author:\\\"Stephen King\\\""
250+
}
251+
}
252+
},
253+
{
254+
"testName": "filtersNotTags",
255+
"isSnippet": true,
256+
"parameters": {
257+
"indexName": "indexName",
258+
"searchParams": {
259+
"filters": "NOT _tags:non-fiction"
260+
}
261+
},
262+
"request": {
263+
"path": "/1/indexes/indexName/query",
264+
"method": "POST",
265+
"body": {
266+
"filters": "NOT _tags:non-fiction"
267+
}
268+
}
269+
},
270+
{
271+
"testName": "facetFiltersList",
272+
"isSnippet": true,
273+
"parameters": {
274+
"indexName": "indexName",
275+
"searchParams": {
276+
"facetFilters": [
277+
[
278+
"author:Stephen King",
279+
"genre:Horror"
280+
],
281+
"publisher:Penguin"
282+
]
283+
}
284+
},
285+
"request": {
286+
"path": "/1/indexes/indexName/query",
287+
"method": "POST",
288+
"body": {
289+
"facetFilters": [
290+
[
291+
"author:Stephen King",
292+
"genre:Horror"
293+
],
294+
"publisher:Penguin"
295+
]
296+
}
297+
}
298+
},
299+
{
300+
"testName": "facetFiltersNeg",
301+
"isSnippet": true,
302+
"parameters": {
303+
"indexName": "indexName",
304+
"searchParams": {
305+
"facetFilters": "category:-Ebook"
306+
}
307+
},
308+
"request": {
309+
"path": "/1/indexes/indexName/query",
310+
"method": "POST",
311+
"body": {
312+
"facetFilters": "category:-Ebook"
313+
}
314+
}
315+
},
316+
{
317+
"testName": "filtersAndFacetFilters",
318+
"isSnippet": true,
319+
"parameters": {
320+
"indexName": "indexName",
321+
"searchParams": {
322+
"filters": "(author:\"Stephen King\" OR genre:\"Horror\")",
323+
"facetFilters": [
324+
"publisher:Penguin"
325+
]
326+
}
327+
},
328+
"request": {
329+
"path": "/1/indexes/indexName/query",
330+
"method": "POST",
331+
"body": {
332+
"filters": "(author:\\\"Stephen King\\\" OR genre:\\\"Horror\\\")",
333+
"facetFilters": [
334+
"publisher:Penguin"
335+
]
336+
}
337+
}
338+
},
339+
{
340+
"testName": "aroundLatLng",
341+
"isSnippet": true,
342+
"parameters": {
343+
"indexName": "indexName",
344+
"searchParams": {
345+
"aroundLatLng": "40.71, -74.01"
346+
}
347+
},
348+
"request": {
349+
"path": "/1/indexes/indexName/query",
350+
"method": "POST",
351+
"body": {
352+
"aroundLatLng": "40.71, -74.01"
353+
}
354+
}
146355
}
147356
]

0 commit comments

Comments
 (0)