Solr:如何在Solr中实现定时折扣
我正在尝试将solr用于书店网站 每本书都有价格,但有时会打折。折扣价格在定义的时间段内存在,但可能有许多折扣期。每个折扣将有一个简短的大纲,开始和结束时间 所需输出的子集如下所示:Solr:如何在Solr中实现定时折扣,solr,Solr,我正在尝试将solr用于书店网站 每本书都有价格,但有时会打折。折扣价格在定义的时间段内存在,但可能有许多折扣期。每个折扣将有一个简短的大纲,开始和结束时间 所需输出的子集如下所示: ....... "response":{"numFound":1,"start":0,"docs":[ { "name":"The Book", "price":"$9.99", "discounts":[ { "price":"$3.00",
.......
"response":{"numFound":1,"start":0,"docs":[
{
"name":"The Book",
"price":"$9.99",
"discounts":[
{
"price":"$3.00",
"synopsis":"thanksgiving special",
"starts":"11-24-2011",
"ends":"11-25-2011",
},
{
"price":"$4.00",
"synopsis":"Canadian thanksgiving special",
"starts":"10-10-2011",
"ends":"10-11-2011",
},
]
},
.........
一个要求是能够搜索刚刚打折的出版物。我想我可以使用日期刻面(返回折扣窗口内的出版物)。执行折扣搜索时,不会返回当前未折扣的出版物
我的问题是:
- solr是否支持这种类型的子文档
- 实现上述目标的最佳方法是什么
非常感谢通过使用Solr的动态字段,您可能可以获得足够接近的结果:
.......
"response":{"numFound":1,"start":0,"docs":[
{
"name":"The Book",
"price":"$9.99",
"discount_1_price":"$3.00",
"discount_1_synopsis":"thanksgiving special",
"discount_1_starts":"11-24-2011",
"discount_1_ends":"11-25-2011",
"discount_2_price":"$4.00",
"discount_2_synopsis":"Canadian thanksgiving special",
"discount_2_starts":"10-10-2011",
"discount_2_ends":"10-11-2011",
},
........
我不确定动态场是否能解决这个问题。假设一本书有100个有效折扣。构造的solr查询看起来如何?