Subversion Repositories SmartDukaan

Rev

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

Rev 30218 Rev 31086
Line 24... Line 24...
24
parser.add_option("-d", "--d", dest="dbHost",
24
parser.add_option("-d", "--d", dest="dbHost",
25
                      default="127.0.0.1",
25
                      default="127.0.0.1",
26
                      type="string", help="The HOST where the mysql server is running",
26
                      type="string", help="The HOST where the mysql server is running",
27
                      metavar="DBHOST")
27
                      metavar="DBHOST")
28
parser.add_option("-s", "--s", dest="solrPath",
28
parser.add_option("-s", "--s", dest="solrPath",
29
                      default="http://localhost:8984/solr/                1",
29
                      default="http://localhost:8984/solr/demo",
30
                      type="string", help="Complete solr path",
30
                      type="string", help="Complete solr path",
31
                      metavar="SOLRHOST")
31
                      metavar="SOLRHOST")
32
parser.add_option("-m", "--m", dest="mongoHost",
32
parser.add_option("-m", "--m", dest="mongoHost",
33
                      default="localhost",
33
                      default="localhost",
34
                      type="string", help="Complete solr path",
34
                      type="string", help="Complete solr path",
Line 268... Line 268...
268
        print "catalogMap", catalogMap
268
        print "catalogMap", catalogMap
269
        active = False
269
        active = False
270
        itemsMap = catalogMap['items']
270
        itemsMap = catalogMap['items']
271
        itemObjs = []
271
        itemObjs = []
272
        for itemId, itemMap in itemsMap.iteritems():
272
        for itemId, itemMap in itemsMap.iteritems():
273
            tags = itemMap['tagPricing']
273
            tags = itemMap.pop('tagPricing')
-
 
274
 
274
            for tag in tags:
275
            for tag in tags:
275
                active = active or tag.active
276
                active = active or tag.active
276
                itemObj = {'id':('itemtag-%s-%s' % (itemId, tag.tag_id)), 'color_s':itemMap['color'], 'itemId_i': itemId, 'tagId_i':tag.tag_id,
277
                itemObj = {'id':('itemtag-%s-%s' % (itemId, tag.tag_id)), 'color_s':itemMap['color'], 'itemId_i': itemId, 'tagId_i':tag.tag_id,
277
                           'mrp_f':tag.mrp, 'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price, 'active_b' : tag.active, 'hot_deal_b': tag.hot_deals}
278
                           'mrp_f':tag.mrp, 'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price, 'active_b' : tag.active, 'hot_deal_b': tag.hot_deals}
278
            itemObjs.append(itemObj)
279
            itemObjs.append(itemObj)
Line 288... Line 289...
288
                      'w7573_i':0,
289
                      'w7573_i':0,
289
                      'w7678_i':0,
290
                      'w7678_i':0,
290
                      'w7720_i':0,
291
                      'w7720_i':0,
291
                      'w8468_i':0,
292
                      'w8468_i':0,
292
                      'w8889_i':0,
293
                      'w8889_i':0,
293
                      'w8947_i':0
294
                      'w8947_i':0,
-
 
295
                      'w9213_i':0
294
                      }
296
                      }
295
        for whId, color in catalogMap['avColor'].iteritems():
297
        for whId, color in catalogMap['avColor'].iteritems():
296
            print catalogId, whId, color, catalogMap['title']
298
            print catalogId, whId, color, catalogMap['title']
297
            catalogObj['w%d_i'%(whId)] = color
299
            catalogObj['w%d_i'%(whId)] = color
298
        catalogObj['active_b'] = active
300
        catalogObj['active_b'] = active
299
        catalogObjs.append(catalogObj)
301
        catalogObjs.append(catalogObj)
300
    solr.delete(q='*:*')
302
    solr.delete(q='*:*')
301
    solr.add(catalogObjs)
303
    solr.add(catalogObjs)
-
 
304
    #print catalogObjs
-
 
305
    #for catalogObj in catalogObjs:
-
 
306
#    solr.add(catalogObj)
302
 
307
 
303
 
308
 
304
def pushData():
309
def pushData():
305
    populateTagItems()
310
    populateTagItems()
306
 
311