Subversion Repositories SmartDukaan

Rev

Rev 22314 | Rev 22316 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22314 Rev 22315
Line 170... Line 170...
170
        itemsMap = catalogMap['items']
170
        itemsMap = catalogMap['items']
171
        itemObjs = []
171
        itemObjs = []
172
        for itemId, itemMap in itemsMap.iteritems():
172
        for itemId, itemMap in itemsMap.iteritems():
173
            tags = itemMap['tagPricing']
173
            tags = itemMap['tagPricing']
174
            for tag in tags:
174
            for tag in tags:
175
                itemObj = {'id':('itemtag-%s-%s'%(itemId, tag.tag_id)), 'color':itemMap['color'],  'itemId': itemId, 'tagId':tag.tag_id, 
175
                itemObj = {'id':('itemtag-%s-%s'%(itemId, tag.tag_id)), 'color_s':itemMap['color'],  'itemId_i': itemId, 'tagId_i':tag.tag_id, 
176
                           'mop': tag.mop, 'sellingPrice': tag.selling_price}
176
                           'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price}
177
            itemObjs.append(itemObj)
177
            itemObjs.append(itemObj)
178
        catalogObj = {'id':'catalog' + str(catalogId), 'rank':catalogMap['rank'], 'title': catalogMap['title'], '_childDocuments_':itemObjs, 'catalogId':catalogId}
178
        catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'], '_childDocuments_':itemObjs, 'catalogId_i':catalogId}
179
        catalogObjs.append(catalogObj)
179
        catalogObjs.append(catalogObj)
180
    
180
    
181
    print catalogObjs
181
    catalogObjs[0]['_childDocuments_'].append({})
182
    solr.delete(q='*:*')
182
    solr.delete(q='*:*')
183
    solr.add(catalogObjs)
183
    solr.add(catalogObjs)
184
        
184
        
185
        
185
        
186
        
186