Reputation: 23
I have a problem to search on two dataSource. When I importAll, I see all my records import but when I search, I have in my results, only dataSource's 2 records.
In my data-config.xml :
<document>
<entity name="one" dataSource="ds-1" query="SELECT * FROM artist">
<field column="name" name="name" />
</entity>
<entity name="two" dataSource="ds-2" query="SELECT * FROM faqdata">
<field column="thema" name="thema" />
</entity>
</document>
And in my schema.xml :
<fields>
<field name="id" type="int" indexed="true" stored="true" required="true" />
<field name="slug" type="string" indexed="false" stored="true"/>
<field name="name" type="text" indexed="true" stored="true" />
<field name="alt_name" type="text" indexed="false" stored="true"/>
<field name="created_at" type="date" indexed="false" stored="true"/>
<field name="updated_at" type="date" indexed="false" stored="true"/>
<field name="thema" type="text" indexed="true" stored="true" />
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*" type="ignored" multiValued="true" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
<copyField source="name" dest="text"/>
<copyField source="thema" dest="text"/>
What is problems? Thank
Upvotes: 0
Views: 830
Reputation: 52809
Ids in Solr needs to be unique.
If you insert Entities with the same Ids the previous record would get overwritten.
Solr does not update records. It deletes and reinserts the records.
If you want both the records, define a unique id.
e.g. Prepend Artist and faqdata to the id so that artists and faqdata don't overwrite each other.
SELECT A.*, 'ARTIST_' || ID PRIMARY_ID FROM ARTIST A
SELECT A.*, 'FAQDATA_' || ID PRIMARY_ID FROM FAQDATA A
and use PRIMARY_ID as the primary id and unique field.
Upvotes: 1