如何解决如何获得最畅销的产品并将其存储在solr中,以及如何检索和显示在类别页面中
为了从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 举报,一经查实,本站将立刻删除。