Subversion Repositories SmartDukaan

Rev

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

Rev 20292 Rev 20322
Line 16... Line 16...
16
parser.add_option("-m", "--m", dest="mongoHost",
16
parser.add_option("-m", "--m", dest="mongoHost",
17
                      default="localhost",
17
                      default="localhost",
18
                      type="string", help="The HOST where the mongo server is running",
18
                      type="string", help="The HOST where the mongo server is running",
19
                      metavar="HOST")
19
                      metavar="HOST")
20
parser.add_option("-s", "--s", dest="solrPath",
20
parser.add_option("-s", "--s", dest="solrPath",
21
                      default="http://localhost:8080/solr/",
21
                      default="http://localhost:8983/solr/",
22
                      type="string", help="Complete solr path",
22
                      type="string", help="Complete solr path",
23
                      metavar="HOST")
23
                      metavar="HOST")
24
 
24
 
25
(options, args) = parser.parse_args()
25
(options, args) = parser.parse_args()
26
 
26
 
Line 63... Line 63...
63
            exception.append(item['_id'])
63
            exception.append(item['_id'])
64
            continue
64
            continue
65
        
65
        
66
        if catalogMap.has_key(int(item['skuBundleId'])):
66
        if catalogMap.has_key(int(item['skuBundleId'])):
67
            skuInfo = catalogMap.get(int(item['skuBundleId']))
67
            skuInfo = catalogMap.get(int(item['skuBundleId']))
68
            print item['_id']
-
 
69
            print item['source_product_name']
-
 
70
            skuInfo.source_product_names.append(item['source_product_name'].strip())
68
            skuInfo.source_product_names.append(item['source_product_name'].strip())
71
            skuInfo.ids.append(int(item['_id']))
69
            skuInfo.ids.append(int(item['_id']))
72
        else:
70
        else:
73
            syn_brand = synonymsMap.get((item['brand']).upper())
71
            syn_brand = synonymsMap.get((item['brand']).upper())
74
            model_syn = modelNameSynonymMap.get(item['skuBundleId'])
72
            model_syn = modelNameSynonymMap.get(item['skuBundleId'])
Line 84... Line 82...
84
                                CATEGORY_MAP.get(int(item['category_id'])), SUB_CATEGORY_MAP.get(int(item['subCategoryId'])))
82
                                CATEGORY_MAP.get(int(item['category_id'])), SUB_CATEGORY_MAP.get(int(item['subCategoryId'])))
85
            except:
83
            except:
86
                print "Exception in item ",item['_id']
84
                print "Exception in item ",item['_id']
87
                continue
85
                continue
88
            catalogMap[int(item['skuBundleId'])] = skuInfo
86
            catalogMap[int(item['skuBundleId'])] = skuInfo
89
            
87
    l=[]        
90
    for data in catalogMap.values():
88
    for data in catalogMap.values():
91
        l=[]
-
 
92
        print data.__dict__
-
 
93
        l.append(data.__dict__)
89
        l.append(data.__dict__)
94
        solr.add(l)
90
    solr.add(l)
95
    
91
 
96
    
-
 
97
    for x in exception:
92
    for x in exception:
98
        print x
93
        print x
99
 
94
 
100
def populateBrandSynonymMap(): 
95
def populateBrandSynonymMap(): 
101
    global synonymsMap
96
    global synonymsMap