Skip to content

Commit 8a6bc09

Browse files
committed
check if dbplyr installed in ragnar_retrieve()
1 parent 76cf664 commit 8a6bc09

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

R/retrieve.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ get_store_embed <- function(x) {
132132

133133

134134
ragnar_retrieve_vss_tbl <- function(tbl, text, top_k, method) {
135+
rlang::check_installed("dbplyr")
135136
.[.., order_key] <- method_to_info(method)
136137
tbl |>
137138
mutate(
@@ -144,7 +145,8 @@ ragnar_retrieve_vss_tbl <- function(tbl, text, top_k, method) {
144145
collect()
145146
}
146147

147-
ragnar_retrieve_bm25_tbl_sql <- function(tbl, text, top_k) {
148+
ragnar_retrieve_bm25_tbl <- function(tbl, text, top_k) {
149+
rlang::check_installed("dbplyr")
148150
con <- dbplyr::remote_con(tbl)
149151
text_quoted <- DBI::dbQuoteString(con, text)
150152

@@ -174,7 +176,7 @@ ragnar_retrieve_bm25 <- function(store, text, top_k = 3L) {
174176
check_string(text)
175177
check_number_whole(top_k)
176178
if (inherits(store, "tbl_sql")) {
177-
return(ragnar_retrieve_bm25_tbl_sql(store, text, top_k))
179+
return(ragnar_retrieve_bm25_tbl(store, text, top_k))
178180
}
179181

180182
cols <- names(store@schema) |>

0 commit comments

Comments
 (0)