@@ -27,9 +27,10 @@ get_get_url <- function(query, base_url, arg_list) {
27
27
base_url ,
28
28
" ?q=" , utils :: URLencode(query , reserved = TRUE ),
29
29
" &f=" , tojson_2(arg_list $ fields ),
30
- " &o =" , tojson_2(arg_list $ opts , auto_unbox = TRUE ),
31
- " &s =" , tojson_2(arg_list $ sort , auto_unbox = TRUE )
30
+ " &s =" , tojson_2(arg_list $ sort , auto_unbox = TRUE ),
31
+ " &o =" , tojson_2(arg_list $ opts , auto_unbox = TRUE )
32
32
)
33
+
33
34
utils :: URLencode(j )
34
35
}
35
36
@@ -39,11 +40,14 @@ get_post_body <- function(query, arg_list) {
39
40
" {" ,
40
41
' "q":' , query , " ," ,
41
42
' "f":' , tojson_2(arg_list $ fields ), " ," ,
42
- ' "o ":' , tojson_2(arg_list $ opts , auto_unbox = TRUE ), " ," ,
43
- ' "s ":' , tojson_2(arg_list $ sort , auto_unbox = TRUE ),
43
+ ' "s ":' , tojson_2(arg_list $ sort , auto_unbox = TRUE ), " ," ,
44
+ ' "o ":' , tojson_2(arg_list $ opts , auto_unbox = TRUE ),
44
45
" }"
45
46
)
46
- gsub(' (,"[fs]":)([,}])' , paste0(" \\ 1" , " {}" , " \\ 2" ), body )
47
+ # The API can now act weirdly if we pass f:{},s:{} as we did in the past.
48
+ # (Weirdly in that the post results may not equal the get results or posts error out)
49
+ # Now we'd remove "f":, and "s":, We're guaranteed to have q: and at least "size":1000 as o:
50
+ gsub(' ("[fs]":,)' , " " , body )
47
51
}
48
52
49
53
# ' @noRd
0 commit comments