我在Solr中使用内部联接,以下查询对我来说很好用:
{!join from = _id to = relationships.collection2.key fromIndex = collection2_shard1_replica1 cache = true} _id:{!join from = _id to = relationships.collection3.key fromIndex = collection3_shard1_replica1 cache = true} name:“cloudProducts”
现在,我正在尝试使用IN查询名称条件,例如名称:(“cloudProducts”或“mobileStation”或“standAlone”),因此我将查询设为:
{!from from = _id to = relations.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 cache = true} _id:{!join from = _id to = relationships.product.targets.key fromIndex = app.products_shard1_replica1 cache = true} str_extensions.tenant.lineOfBusiness.value.name :(“cloudProducts”或“mobileStation”或“standAlone”)
但是它给出了解析异常。我试过操纵语法但没有成功。是否可以在Solr内连接中使用IN查询?谁能帮我这个?
答案 0 :(得分:0)
我能够通过将内部查询传递给' v'来解决这个问题。内连接中的关键字。
{!from from = _id to = relations.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 cache = true} _id:{!join from = _id to = relationships.product.targets.key fromIndex = app.products_shard1_replica1 cache = true v = str_extensions.tenant.lineOfBusiness.value.name :(" cloudProducts" OR" mobileStation" OR" standAlone")}
OR
你可以使用v = $ innerQuery并在Solr params中传递内部查询的值。
{!from from = _id to = relations.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 cache = true} _id:{!join from = _id to = relationships.product.targets.key fromIndex = app.products_shard1_replica1 cache = true v = $ innerQuery}
PARAMS: distrib = false& innerJoinQuery1 = str_extensions.tenant.lineOfBusiness.value.name :(" cloudProducts" OR" mobileStation" OR" standAlone")