| Line 21... |
Line 21... |
| 21 |
parser.add_option("-d", "--d", dest="dbHost",
|
21 |
parser.add_option("-d", "--d", dest="dbHost",
|
| 22 |
default="127.0.0.1",
|
22 |
default="127.0.0.1",
|
| 23 |
type="string", help="The HOST where the mysql server is running",
|
23 |
type="string", help="The HOST where the mysql server is running",
|
| 24 |
metavar="DBHOST")
|
24 |
metavar="DBHOST")
|
| 25 |
parser.add_option("-s", "--s", dest="solrPath",
|
25 |
parser.add_option("-s", "--s", dest="solrPath",
|
| 26 |
default="http://localhost:8984/solr/collection2",
|
26 |
default="http://localhost:8983/solr/demo",
|
| 27 |
type="string", help="Complete solr path",
|
27 |
type="string", help="Complete solr path",
|
| 28 |
metavar="SOLRHOST")
|
28 |
metavar="SOLRHOST")
|
| 29 |
parser.add_option("-m", "--m", dest="mongoHost",
|
29 |
parser.add_option("-m", "--m", dest="mongoHost",
|
| 30 |
default="localhost",
|
30 |
default="localhost",
|
| 31 |
type="string", help="Complete solr path",
|
31 |
type="string", help="Complete solr path",
|
| 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_s':itemMap['color'], 'itemId_i': itemId, 'tagId_i':tag.tag_id,
|
175 |
itemObj = {'id':('itemtag-%s-%s'%(itemId, tag.tag_id)), 'color':itemMap['color'], 'itemId': itemId, 'tagId':tag.tag_id,
|
| 176 |
'mop_f': tag.mop, 'sellingPrice_f': tag.selling_price}
|
176 |
'mop': tag.mop, 'sellingPrice': tag.selling_price}
|
| 177 |
itemObjs.append(itemObj)
|
177 |
itemObjs.append(itemObj)
|
| 178 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank_i':catalogMap['rank'], 'title_s': catalogMap['title'], '_childDocuments_':itemObjs, 'catalogId_i':catalogId}
|
178 |
catalogObj = {'id':'catalog' + str(catalogId), 'rank':catalogMap['rank'], 'title': catalogMap['title'], '_childDocuments_':itemObjs, 'catalogId':catalogId}
|
| 179 |
catalogObjs.append(catalogObj)
|
179 |
catalogObjs.append(catalogObj)
|
| 180 |
|
180 |
|
| 181 |
print catalogObjs
|
181 |
print catalogObjs
|
| 182 |
solr.delete(q='*:*')
|
182 |
solr.delete(q='*:*')
|
| 183 |
solr.add(catalogObjs)
|
183 |
solr.add(catalogObjs)
|