Solr Join未返回任何结果

33qvvth1  于 2022-11-05  发布在  Solr
关注(0)|答案(1)|浏览(168)

我使用Solr 8.10作为带有自定义模式的Docker,该模式包含以下行:

<uniqueKey>id</uniqueKey>

    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="relationship_name" type="keywordAnalyzer" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="entity_docRef1" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="entity_docRef2" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="created_at" type="date" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="modified_at" type="date" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="created_by" type="string" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="modified_by" type="string" indexed="true" stored="true" required="true" multiValued="false" />

    <dynamicField name="___target*" type="string" indexed="true" stored="true" multiValued="false"/>
    <dynamicField name="___source*" type="string" indexed="true" stored="true" multiValued="false"/>
    <dynamicField name="___link*" type="string" indexed="true" stored="true" multiValued="false"/>

我使用postman创建了以下数据

[
  {
    "id": "44",
    "relationship_name": "Co-insured",
    "entity_docRef1": "HomeInsurence/1",
    "entity_docRef2": "BusinessPartner/Tomas",
    "created_at": "2021-10-18T14:38:20.985Z",
    "created_by": "admin",
    "modified_at": "2021-10-18T14:38:20.985Z",
    "modified_by": "admin",
    "fulltext": "data",
    "___target.name": "Tomas Bajus",
    "___target.region": "Slovakia",
    "___source.contract.company": "Generali",
    "___source.contract.id": "Generali/1",
    "___link.signed_at": "2021-10-18T14:38:20.985Z"
  },
  {
    "id": "48",
    "relationship_name": "PostalAddress",
    "entity_docRef1": "BusinessPartner/Tomas",
    "entity_docRef2": "PostalAddress/1",
    "created_at": "2021-10-18T14:38:20.985Z",
    "created_by": "admin",
    "modified_at": "2021-10-18T14:38:20.985Z",
    "modified_by": "admin",
    "fulltext": "data",
    "___source.name": "Tomas Bajus",
    "___source.region": "Slovakia",
    "___target.City": "Presov",
    "___target.Street_name": "Hlavna 1",
    "___target.zip": "08271"
  }
]

使用管理控制台可以在Solr中看到创建的数据:

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"*:*",
      "fl":"*",
      "q.op":"OR",
      "_":"1634718235445"}},
  "response":{"numFound":2,"start":0,"numFoundExact":true,"docs":[
      {
        "id":"44",
        "relationship_name":"Co-insured",
        "entity_docRef1":"HomeInsurence/1",
        "entity_docRef2":"BusinessPartner/Tomas",
        "created_at":"2021-10-18T14:38:20.985Z",
        "created_by":"admin",
        "modified_at":"2021-10-18T14:38:20.985Z",
        "modified_by":"admin",
        "___target.name":"Tomas Bajus",
        "___target.region":"Slovakia",
        "___source.contract.company":"Generali",
        "___source.contract.id":"Generali/1",
        "___link.signed_at":"2021-10-18T14:38:20.985Z",
        "_version_":1714126727193559040},
      {
        "id":"48",
        "relationship_name":"PostalAddress",
        "entity_docRef1":"BusinessPartner/Tomas",
        "entity_docRef2":"PostalAddress/1",
        "created_at":"2021-10-18T14:38:20.985Z",
        "created_by":"admin",
        "modified_at":"2021-10-18T14:38:20.985Z",
        "modified_by":"admin",
        "___source.name":"Tomas Bajus",
        "___source.region":"Slovakia",
        "___target.City":"Presov",
        "___target.Street_name":"Hlavna 1",
        "___target.zip":"08271",
        "_version_":1714126727567900672}]
  }}

我正在尝试执行以下联接

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"{!join from=entity_docRef1 to=entity_docRef2}___target.zip: 08271",
      "fl":"*",
      "q.op":"OR",
      "_":"1634718235445"}},
  "response":{"numFound":0,"start":0,"numFoundExact":true,"docs":[]
  }}

但是我没有响应。我的目的是通过在其他文档上筛选___target.zip来获得结果集中的文档44。
我做错了什么?为什么连接查询没有结果?我认为id必须在join to to语句中指定,但Solr www.example.com的文档中没有指定这样的要求https://solr.apache.org/guide/8_10/other-parsers.html#join-query-parser
from包含要在“to”字段中查找的值的字段的名称。可以是单值或多值,但必须具有与“to”字段中表示的字段兼容的字段类型。此参数是必需的。
to字段的名称,该字段的值将根据“from”字段中找到的值进行检查。可以是单值或多值,但必须具有与“from”字段兼容的字段类型。此参数是必需的。
我已经尝试了示例中的join语句,这个语句运行良好,但是join请求看起来完全一样
谢谢你的帮助!

px9o7tmv

px9o7tmv1#

通过添加JoinParser更新solrconfig.xml,解决了此问题

相关问题