Django Solr索引使用SortedMapBackedCache快速构建,返回缺少数据库列值的文档结果
.我的Django应用程序中有两个表: 产品与商家 商户是产品中的外键 下面是我的data-config.xml的一个片段:Django Solr索引使用SortedMapBackedCache快速构建,返回缺少数据库列值的文档结果,django,solr,dataimporthandler,Django,Solr,Dataimporthandler,.我的Django应用程序中有两个表: 产品与商家 商户是产品中的外键 下面是我的data-config.xml的一个片段: <entity name="products_product" query="SELECT id, merchant_id, product_id, retail_price, date_created FROM products_product" transformer="script:generate_resource_uri"&
<entity name="products_product"
query="SELECT id, merchant_id, product_id, retail_price, date_created FROM products_product"
transformer="script:generate_resource_uri">
<entity name="merchant"
query="SELECT merchant_name, commission, commission_type FROM products_merchant"
cacheKey='id' cacheLookup='products_product.merchant_id'
cacheImpl="SortedMapBackedCache">
<field column="merchant_name" name="merchant_name"/>
<field column="commission" name="commission"/>
<field column="commission_type" name="commission_type"/>
</entity>
</entity>
没有按预期工作。索引构建时间缩短了,因为已经获取的查询是从缓存中获取的,但是我没有在结果中获取这些字段:
merchant_name, commission, commission_type
我可能做错了什么?您是否尝试过在SELECT查询中包含“商户”实体的“id”列?当您指定它将是与查找键匹配的键时
<entity name="merchant"
query="SELECT id, merchant_name, commission, commission_type FROM products_merchant"
cacheKey='id' cacheLookup='products_product.merchant_id'
cacheImpl="SortedMapBackedCache">
<field column="merchant_name" name="mer`enter code here`chant_name"/>
<field column="commission" name="commission"/>
<field column="commission_type" name="commission_type"/>
</entity>
你在日志中看到任何可疑的东西吗?@AnkitPopli是的<代码>294905[qtp865058941-11]INFO org.apache.solr.handler.dataimport.DataImporter–加载DIH配置:data-config.xml 294911[qtp865058941-11]INFO org.apache.solr.handler.dataimport.config.DIHConfiguration–id是SolrSchema中的必填字段。但在DataConfig中找不到
<entity name="merchant"
query="SELECT id, merchant_name, commission, commission_type FROM products_merchant"
cacheKey='id' cacheLookup='products_product.merchant_id'
cacheImpl="SortedMapBackedCache">
<field column="merchant_name" name="mer`enter code here`chant_name"/>
<field column="commission" name="commission"/>
<field column="commission_type" name="commission_type"/>
</entity>