query_gen_actors: removed country argument, now reading country directly from actor data

master
Erik de Vries 4 years ago
parent 64a48e5977
commit 7703a8cd5b

@ -2,7 +2,6 @@
#' #'
#' Generate actor search queries based on data in actor db #' Generate actor search queries based on data in actor db
#' @param actor A row from the output of elasticizer() when run on the 'actor' index #' @param actor A row from the output of elasticizer() when run on the 'actor' index
#' @param country 2-letter string indicating the country for which to generate the queries, is related to inflected nouns, definitive forms and genitive forms of names etc.
#' @param pre_tags Highlighter pre-tag #' @param pre_tags Highlighter pre-tag
#' @param post_tags Highlighter post-tag #' @param post_tags Highlighter post-tag
#' @return A data frame containing the queries, related actor ids and actor function #' @return A data frame containing the queries, related actor ids and actor function
@ -13,7 +12,7 @@
################################################################################################# #################################################################################################
#################################### Actor search query generator ############################### #################################### Actor search query generator ###############################
################################################################################################# #################################################################################################
query_gen_actors <- function(actor, country, pre_tags, post_tags) { query_gen_actors <- function(actor, pre_tags, post_tags) {
generator <- function(country, startdate, enddate, querystring, pre_tags, post_tags, actorid) { generator <- function(country, startdate, enddate, querystring, pre_tags, post_tags, actorid) {
return(paste0('{"_source": ["ud","title","subtitle","preteaser","teaser","text"], return(paste0('{"_source": ["ud","title","subtitle","preteaser","teaser","text"],
"query": "query":
@ -56,6 +55,7 @@ query_gen_actors <- function(actor, country, pre_tags, post_tags) {
paste0('\\"',grid[row,]$first,' ',grid[row,]$last,'\\"~',grid[row,]$prox) paste0('\\"',grid[row,]$first,' ',grid[row,]$last,'\\"~',grid[row,]$prox)
) )
} }
country <- actor$`_source.country`
### Setting linguistic forms for each country ### ### Setting linguistic forms for each country ###
if (country == "no" | country == "dk") { if (country == "no" | country == "dk") {
genitive <- 's' genitive <- 's'

@ -4,13 +4,11 @@
\alias{query_gen_actors} \alias{query_gen_actors}
\title{Generate actor search queries based on data in actor db} \title{Generate actor search queries based on data in actor db}
\usage{ \usage{
query_gen_actors(actor, country, pre_tags, post_tags) query_gen_actors(actor, pre_tags, post_tags)
} }
\arguments{ \arguments{
\item{actor}{A row from the output of elasticizer() when run on the 'actor' index} \item{actor}{A row from the output of elasticizer() when run on the 'actor' index}
\item{country}{2-letter string indicating the country for which to generate the queries, is related to inflected nouns, definitive forms and genitive forms of names etc.}
\item{pre_tags}{Highlighter pre-tag} \item{pre_tags}{Highlighter pre-tag}
\item{post_tags}{Highlighter post-tag} \item{post_tags}{Highlighter post-tag}

Loading…
Cancel
Save