From 7604180fcf65bd3fe5a2d49f46d434199fe95831 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 29 Jan 2019 21:10:33 -0600 Subject: [PATCH] changed strategy for dropping duplicates (fixes #137) --- r-pkg/R/es_search.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-pkg/R/es_search.R b/r-pkg/R/es_search.R index 9e175d8..f88f2cf 100644 --- a/r-pkg/R/es_search.R +++ b/r-pkg/R/es_search.R @@ -100,7 +100,7 @@ es_search <- function(es_host ) log_fatal(msg) } - + # assign 1 core by default, if the number of cores is NA if (is.na(n_cores) || !assertthat::is.count(n_cores)){ msg <- "detectCores() returned NA. Assigning number of cores to be 1." @@ -397,7 +397,7 @@ es_search <- function(es_host # It's POSSIBLE that the parallel process gave us duplicates. Correct for that data.table::setkeyv(outDT, NULL) - outDT <- unique(outDT) + outDT <- unique(outDT, by = "_id") # Check we got the number of unique records we expected if (nrow(outDT) < hits_to_pull && break_on_duplicates){