Search among two entities
i am new to solr. I have create开发者_如何学运维d 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.
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
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.
精彩评论