在两个实体之间搜索

发布于 2024-12-10 01:52:17 字数 925 浏览 1 评论 0原文

我是 solr 新手。我创建了两个不相关的独立实体。

在db-data-config.xml中

<entity name="vtab" query="select pid as id, pname as name from ptab order by name asc">
    <field column="panchayat_id" name="panchayat_id" />
    <field column="name" name="name" />
</entity>
<entity name="ptab" query="select vid as id, vname as name from vtab order by name asc">
    <field column="id" name="vid" />
    <field column="name" name="name" />
</entity>

在scheme.xml中

<fields>
    <field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="text" indexed="true" stored="true" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>name</defaultSearchField>

使用此配置成功创建索引。我想按名字搜索。如果我在查询中提供名称,我希望它来自找到记录的任何表。通过上述配置,我仅从 vtab 获取记录。 ptab 中没有搜索任何记录。请指导我哪里出错了。

i am new to solr. I have created two separate entities which are not interrelated.

In db-data-config.xml

<entity name="vtab" query="select pid as id, pname as name from ptab order by name asc">
    <field column="panchayat_id" name="panchayat_id" />
    <field column="name" name="name" />
</entity>
<entity name="ptab" query="select vid as id, vname as name from vtab order by name asc">
    <field column="id" name="vid" />
    <field column="name" name="name" />
</entity>

In scheme.xml

<fields>
    <field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="text" indexed="true" stored="true" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>name</defaultSearchField>

The index is created successfully with this configuration. I want to search by name. If i provide name in query, i want it from any of the table where record is found. With above configuration, i am getting records from only vtab. No records are being searched in ptab. Please guide me where i am going wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜中书 2024-12-17 01:52:17

您已将 vtab 实体命名为 ptab,反之亦然。
您可以添加到名为 vtab 的实体并检查它们是否正确索引。
id 是唯一的吗?如果 id 重复,它们将相互覆盖。
理想情况下,它应该同时搜索

you have named the vtab entity as ptab and vice versa.
Can you add to the entity named vtab and check they are indexed properly.
Are the ids unique? If the ids are duplicate they would override each other.
Ideally, It should search across both

不美如何 2024-12-17 01:52:17

问题解决了。我已将“id”声明为主键,但该主键已被重复。我结合 id-table_name 创建了另一个字段并将其设置为主键。现在可以正常工作了。谢谢贾延德拉·帕蒂尔先生。

problem is solved. I had declared "id" as primary key, which was being duplicated. I created another field in combination with id-table_name and set it to primary key. Its working properly now. Thank you Mr. Jayendra Patil.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文