Solr:我如何在solr中实现定时折扣可用性
问题描述:
我正尝试使用solr作为书店网站。Solr:我如何在solr中实现定时折扣可用性
每本书都会有价格,但有时会打折扣。折扣价格在特定时间段内存在,但可能有很多折扣期限。每个折扣将有一个简要的简介,开始和结束时间。
所需输出的一个子集是如下:
.......
"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不是一个关系数据库,但我想在上面的表示中尽可能地存储(和索引)一个文档。
- 什么是接近上述
我可以在很多的例子,作者倾向于进行非规范化来解决类似的问题看到的最好的方法。这表明,对于每次折扣,我需要复制图书数据或形成document association。你会建议哪种方法?
如果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查询将如何查看? – Judioo 2011-04-04 04:29:13