问题描述
为了从db检索数据,我使用了cron作业来检索数据并将数据插入到新的畅销产品表中。该表仅包含一列,其中包含产品集合。当我编写查询以从数据库中检索最畅销的产品时,我的问题就从这里开始。
创建表以存储最畅销的产品数据:
<collectiontypes><br> <collectiontype code="topsellingproductscodes" elementtype="Product" autocreate="true" type="set"/><br></collectiontypes>
<itemtype code="TopSoldProducts">
<deployment table="TopSoldProducts" typecode="23677"/>
<attributes>
<attribute qualifier="products" type="topsellingproductscodes">
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
select {p.pk} from {order as o join OrderStatus as os on {os.pk}={o.status}join orderentry as oe on{oe.order}={o.pk}join product as p on {oe.product}={p.pk}}where {os.code}='COMPLETED' AND {o.date}>'2017-08-16 00:00:00.000' AND{o.date}<'2020-09-30 00:00:00.000' group by{p.pk}order by count({oe.pk}) desc limit 10.
它仅返回这样的产品pk(,'ApparelStyleVariantProductModel(8796267708417 @ 12)','ApparelStyleVariantProductModel(8796267282433 @ 14)','ApparelProductModel(8796267020289 @ 16)',),但我想要所有产品信息,以便我可以轻松地将数据存储到新创建的表中。
如何将数据存储到solr中(我不知道如何将数据索引到solr中)?
如何使用控制器从solr中检索索引数据并将其显示在现有类别页面上?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)