| Line 136... |
Line 136... |
| 136 |
projection={'defaultImageUrl':1}
|
136 |
projection={'defaultImageUrl':1}
|
| 137 |
for tag, item in tuples:
|
137 |
for tag, item in tuples:
|
| 138 |
if not catalogMap.has_key(item.catalog_item_id):
|
138 |
if not catalogMap.has_key(item.catalog_item_id):
|
| 139 |
catalogObj = {}
|
139 |
catalogObj = {}
|
| 140 |
catalogObj['title'] = " ".join(filter(None, [item.brand, item.model_name, item.model_number]))
|
140 |
catalogObj['title'] = " ".join(filter(None, [item.brand, item.model_name, item.model_number]))
|
| 141 |
catalogObj['brand'] = item.brand
|
141 |
catalogObj['brand'] = (item.brand)
|
| - |
|
142 |
if item.brand == 'Huawei' or item.brand == 'Honor':
|
| - |
|
143 |
catalogObj['brand'] = ('Huawei', 'Honor')
|
| 142 |
catalogObj['identifier'] = item.catalog_item_id
|
144 |
catalogObj['identifier'] = item.catalog_item_id
|
| 143 |
catalogObj['items'] = {}
|
145 |
catalogObj['items'] = {}
|
| 144 |
catalogObj['hot_deals'] = "False"
|
146 |
catalogObj['hot_deals'] = "False"
|
| 145 |
filterMap = {"_id":item.catalog_item_id}
|
147 |
filterMap = {"_id":item.catalog_item_id}
|
| 146 |
#Dont include it catalog not available
|
148 |
#Dont include it catalog not available
|
| 147 |
try:
|
149 |
try:
|
| 148 |
catalogObj['imageUrl'] = get_mongo_connection(options.mongoHost).CONTENT.siteContent.find_one(filterMap, projection)['defaultImageUrl']
|
150 |
catalogObj['imageUrl'] = get_mongo_connection(options.mongoHost).CONTENT.siteContent.find_one(filterMap, projection)['defaultImageUrl']
|
| 149 |
print catalogObj['imageUrl']
|
151 |
print catalogObj['imageUrl']
|
| 150 |
except:
|
152 |
except:
|
| 151 |
try:
|
153 |
try:
|
| 152 |
catalogObj['imageUrl'] = 'http://api.profittill.com/uploads/campaigns/' + str(item.catalog_item_id) + '.jpg'
|
154 |
catalogObj['imageUrl'] = 'http://api.profittill.com/uploads/campaigns/Image-not-available_1.jpg'
|
| 153 |
except:
|
155 |
except:
|
| 154 |
traceback.print_exc()
|
156 |
traceback.print_exc()
|
| 155 |
continue
|
- |
|
| 156 |
try:
|
157 |
try:
|
| 157 |
catalogObj['rank'] = tagRankingList.index(item.catalog_item_id)
|
158 |
catalogObj['rank'] = tagRankingList.index(item.catalog_item_id)
|
| 158 |
except:
|
159 |
except:
|
| 159 |
#A very big number
|
160 |
#A very big number
|
| 160 |
catalogObj['rank'] = 50000000
|
161 |
catalogObj['rank'] = 50000000
|
| Line 184... |
Line 185... |
| 184 |
tags = itemMap['tagPricing']
|
185 |
tags = itemMap['tagPricing']
|
| 185 |
for tag in tags:
|
186 |
for tag in tags:
|
| 186 |
itemObj = {'id':('itemtag-%s-%s'%(itemId, tag.tag_id)), 'color_s':itemMap['color'], 'itemId_i': itemId, 'tagId_i':tag.tag_id,
|
187 |
itemObj = {'id':('itemtag-%s-%s'%(itemId, tag.tag_id)), 'color_s':itemMap['color'], 'itemId_i': itemId, 'tagId_i':tag.tag_id,
|
| 187 |
'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price}
|
188 |
'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price}
|
| 188 |
itemObjs.append(itemObj)
|
189 |
itemObjs.append(itemObj)
|
| 189 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'],'hot_deals_b':catalogMap['hot_deals'], '_childDocuments_':itemObjs, 'catalogId_i':catalogId, 'imageUrl_s': catalogMap['imageUrl'],
|
190 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'],'hot_deals_b':catalogMap['hot_deals'],
|
| - |
|
191 |
'_childDocuments_':itemObjs,
|
| - |
|
192 |
'catalogId_i':catalogId, 'imageUrl_s': catalogMap['imageUrl'],
|
| 190 |
'brand_s': catalogMap['brand'], 'create_s':catalogMap['create_timestamp'], 'categoryId_i':catalogMap['categoryId']}
|
193 |
'brand_ss': catalogMap['brand'], 'create_s':catalogMap['create_timestamp'], 'categoryId_i':catalogMap['categoryId']}
|
| 191 |
catalogObjs.append(catalogObj)
|
194 |
catalogObjs.append(catalogObj)
|
| 192 |
solr.delete(q='*:*')
|
195 |
solr.delete(q='*:*')
|
| 193 |
solr.add(catalogObjs)
|
196 |
solr.add(catalogObjs)
|
| 194 |
|
197 |
|
| 195 |
|
198 |
|