【问题标题】:Using IN query in Solr inner joins在 Solr 内部连接中使用 IN 查询
【发布时间】:2015-09-29 08:31:43
【问题描述】:

我在 Solr 中使用内部联接,以下查询对我来说很好:

{!join from =_id to = relations.collection2.key fromIndex = collection2_shard1_replica1 cache=true}_id:{!join from =_id to = Relations.collection3.key fromIndex = collection3_shard1_replica1 cache=true}name:"cloudProducts"

现在,我正在尝试对名称条件使用 IN 查询,例如 name:("cloudProducts" OR "mobileStation" OR "standAlone"),所以我的查询如下:

{!从 =_id 加入到 =relationships.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 缓存=true}_id:{!从 =_id 加入 =relationships.product.targets.key fromIndex = app.products_shard1_replica1 缓存=true}str_extensions.tenant.lineOfBusiness.value.name:("cloudProducts" OR "mobileStation" OR "standAlone")

但它给出了解析异常。我尝试操纵语法但没有成功。是否可以在 Solr 内部连接中使用 IN 查询?谁能帮我这个?

【问题讨论】:

  • 如果默认运算符为 OR,那么您可以将查询指定为 - name:('cloudProducts' 'mobileStation' 'standAlone')。您能否提供异常的详细信息
  • 否,OR 不是默认运算符
  • "str_extensions.tenant.lineOfBusiness.value" 这是什么值?...这是“名称”的前缀?...在​​前面的查询中没有...
  • "str_extensions.tenant.lineOfBusiness.value 是字段名

标签: solr inner-join


【解决方案1】:

我能够通过在内部联接中传递带有“v”关键字的内部查询来解决这个问题。

{!从 =_id 加入到 =relationships.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 缓存=true}_id:{!从 =_id 加入 =relationships.product.targets.key fromIndex = app.products_shard1_replica1 缓存=true v=str_extensions.tenant.lineOfBusiness.value.name:("cloudProducts" OR "mobileStation" OR "standAlone")}

您可以使用 v=$innerQuery 并在 Solr 参数中传递内部查询的值。

{!从 =_id 加入到 =relationships.covered.targets.key fromIndex = app.coveredassets_shard1_replica1 缓存=true}_id:{!从 =_id 加入 =relationships.product.targets.key fromIndex = app.products_shard1_replica1 缓存=true v=$innerQuery}

参数: distrib=false&innerJoinQuery1=str_extensions.tenant.lineOfBusiness.value.name:("cloudProducts" OR "mobileStation" OR "standAlone")

【讨论】:

    猜你喜欢
    • 2014-08-13
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多