我正在尝试将大量数据(> 10万条记录)加载到SOLR中。
我想根据某些列值拆分查询,并避免在多个实体中重复查询,使用不同的where子句。所以我决定使用DIH的能力来嵌套实体。
除了在子实体中填充的字段不受UpdateProcessorChain中定义的处理器工厂影响之外,所有内容都按预期工作。仅更新父实体中的那些字段。 我的数据配置文件有,
<entity name="nationalSearchResults" onError="skip"
query="select distinct zip, state, city
from table.location
where transformer="RegexTransformer">
<field column="ZIP" name="id"/>
<field column="STATE" name="state"/>
<field column="CITY" name="city"/>
<entity child="true" name="nationalSearchResultsByState" onError="skip"
query="SELECT b.zip, c.lctn_id, c.restaurants, c.pubs, c.coffeeshops, c.cinemas
from table.location b
join table.business c on c.zip = b.zip"
transformer="script:searchResultsTransformer, RegexTransformer">
<field column="LCTN_ID" name="id"/>
<field column="RESTAURANTS" name="restaurants"/>
<field column="PUBS" name="pubs"/>
<field column="COFFEESHOPS" name="coffeeshops"/>
<field column="CINEMAS" name="cinemas"/>
<field column="ZIP" name="zip"/>
</entity>
</entity>
我的Solr配置文件有,
<updateRequestProcessorChain name="updateOnCommit">
<processor class="DistributedUpdateProcessorFactory"/>
<processor class="TrimFieldUpdateProcessorFactory" />
<processor class="RemoveBlankFieldUpdateProcessorFactory" />
<!-- To remove duplicate values in a multivalued field-->
<processor class="UniqFieldsUpdateProcessorFactory">
<str name="fieldRegex">restaurant*</str>
<str name="fieldRegex">pub*</str>
<str name="fieldRegex">cinema*</str>
</processor>
<processor class="solr.LogUpdateProcessorFactory" />
<processor class="solr.RunUpdateProcessorFactory" /> <!-- Necessary. Unless explicitly executing update commands in an alternative custom !UpdateRequestProcessorFactory -->
<requestHandler name="/dataimport" class="DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
<str name="update.chain">updateOnCommit</str>
</lst>
我错过了什么吗?我似乎无法找到任何特定于updateProcessorChain和子实体的内容。感谢您的帮助。谢谢!