Support Questions

Find answers, ask questions, and share your expertise

set morphline variable from if command

avatar
Explorer

Is it possble to set the value of SOLR_LOCATOR from a morphline if command? I want to assign which collection the output data should flow to based on a contains match of a substring within the _attachment_body.

1 ACCEPTED SOLUTION

avatar
Super Collaborator
All variables have to statically resolve at compile time. Still, you can statically enumerate multiple solrLocators and do stuff like this:

if
{
conditions : [
{ equals { tenant : [foo] } }
]
then : [
{
loadSolr { solrLocator : { collection : collection_foo, zkHost : "127.0.0.1:2181/solr" } }
}
]
else : [
{
loadSolr { solrLocator : { collection : collection_bar, zkHost : "127.0.0.1:2181/solr" } }
}
]
}

Wolfgang.

View solution in original post

1 REPLY 1

avatar
Super Collaborator
All variables have to statically resolve at compile time. Still, you can statically enumerate multiple solrLocators and do stuff like this:

if
{
conditions : [
{ equals { tenant : [foo] } }
]
then : [
{
loadSolr { solrLocator : { collection : collection_foo, zkHost : "127.0.0.1:2181/solr" } }
}
]
else : [
{
loadSolr { solrLocator : { collection : collection_bar, zkHost : "127.0.0.1:2181/solr" } }
}
]
}

Wolfgang.