actorizer: moved some code

master
Your Name 4 years ago
parent 50f33e78d7
commit ecdb5be3b4

@ -89,7 +89,10 @@ actorizer <- function(out, localhost = F, ids, prefix, postfix, pre_tags, post_t
!str_detect(sentence, paste0(post_tags_regex,'(',postfix,')')) & !str_detect(sentence, paste0('(',prefix,')',pre_tags_regex))
)
}
if (nrow(hits) == 0) {
print("Nothing to update for this batch")
return(NULL)
} else {
hits <- hits %>%
group_by(`_id`) %>%
summarise(
@ -108,11 +111,6 @@ actorizer <- function(out, localhost = F, ids, prefix, postfix, pre_tags, post_t
rel_first = 1-(first/sentence_count), # Relative position of first occurrence at sentence level
) %>%
select(`_id`:occ, prom,rel_first,first,ids)
if (nrow(hits) == 0) {
print("Nothing to update for this batch")
return(NULL)
} else {
bulk <- apply(hits, 1, bulk_writer, varname ='actorsDetail', type = 'add', ver = ver)
bulk <- c(bulk,apply(hits[c(1,11)], 1, bulk_writer, varname='actors', type = 'add', ver = ver))
return(elastic_update(bulk, es_super = es_super, localhost = localhost))

Loading…
Cancel
Save