| Line 9... |
Line 9... |
| 9 |
from datastore.DataAccessor import *
|
9 |
from datastore.DataAccessor import *
|
| 10 |
|
10 |
|
| 11 |
lucene.initVM(classpath=lucene.CLASSPATH)
|
11 |
lucene.initVM(classpath=lucene.CLASSPATH)
|
| 12 |
ps = os.pathsep
|
12 |
ps = os.pathsep
|
| 13 |
ds = os.sep
|
13 |
ds = os.sep
|
| - |
|
14 |
da = DataHelper()
|
| - |
|
15 |
da.initxy()
|
| 14 |
|
16 |
|
| 15 |
#analyzer = lucene.
|
- |
|
| 16 |
analyzer = lucene.StandardAnalyzer()
|
17 |
analyzer = lucene.StandardAnalyzer()
|
| 17 |
#analyzer = lucene.SimpleAnalyzer()
|
- |
|
| 18 |
# Creating the Index
|
18 |
# Creating the Index
|
| 19 |
path_index1 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "index1"
|
19 |
path_index1 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "infibeamindex"
|
| 20 |
#Create the Index Writer
|
20 |
#Create the Index Writer
|
| 21 |
writer = lucene.IndexWriter(path_index1,analyzer,True)
|
21 |
writer = lucene.IndexWriter(path_index1,analyzer,True)
|
| 22 |
|
22 |
|
| 23 |
da = DataHelper()
|
- |
|
| 24 |
da.initxy()
|
- |
|
| 25 |
|
23 |
|
| 26 |
phones = da.get_all_infibeam_data()
|
24 |
phones = da.get_all_infibeam_data()
|
| 27 |
for p in phones:
|
25 |
for p in phones:
|
| 28 |
doc = lucene.Document()
|
26 |
doc = lucene.Document()
|
| 29 |
id = p.id
|
27 |
id = p.id
|
| 30 |
#print id
|
- |
|
| 31 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
28 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| 32 |
name = p.name
|
29 |
name = p.name
|
| 33 |
#print name
|
- |
|
| 34 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
30 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| 35 |
price = p.final_price
|
31 |
price = p.final_price
|
| 36 |
#print price
|
- |
|
| 37 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
32 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| 38 |
print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
33 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| 39 |
writer.addDocument(doc)
|
34 |
writer.addDocument(doc)
|
| 40 |
print str(writer.docCount())
|
35 |
#print str(writer.docCount())
|
| - |
|
36 |
writer.close()
|
| 41 |
|
37 |
|
| - |
|
38 |
path_index2 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "indiaplazaindex"
|
| - |
|
39 |
#Create the Index Writer
|
| - |
|
40 |
writer = lucene.IndexWriter(path_index2,analyzer,True)
|
| 42 |
|
41 |
|
| - |
|
42 |
phones = da.get_all_indiaplaza_phones()
|
| - |
|
43 |
for p in phones:
|
| - |
|
44 |
doc = lucene.Document()
|
| - |
|
45 |
id = p.id
|
| - |
|
46 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
47 |
name = p.p_name
|
| - |
|
48 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| - |
|
49 |
price = p.p_final_price
|
| - |
|
50 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
51 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| - |
|
52 |
writer.addDocument(doc)
|
| - |
|
53 |
#print str(writer.docCount())
|
| - |
|
54 |
writer.close()
|
| - |
|
55 |
|
| - |
|
56 |
|
| - |
|
57 |
path_index3 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "univercellindex"
|
| - |
|
58 |
#Create the Index Writer
|
| - |
|
59 |
writer = lucene.IndexWriter(path_index3,analyzer,True)
|
| - |
|
60 |
|
| - |
|
61 |
phones = da.get_all_univercell_phones()
|
| - |
|
62 |
for p in phones:
|
| - |
|
63 |
doc = lucene.Document()
|
| - |
|
64 |
id = p.id
|
| - |
|
65 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
66 |
name = p.p_title
|
| - |
|
67 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| - |
|
68 |
price = p.p_final_price
|
| - |
|
69 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
70 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| - |
|
71 |
writer.addDocument(doc)
|
| - |
|
72 |
#print str(writer.docCount())
|
| - |
|
73 |
writer.close()
|
| - |
|
74 |
|
| - |
|
75 |
|
| - |
|
76 |
path_index4 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "babuchakindex"
|
| - |
|
77 |
#Create the Index Writer
|
| - |
|
78 |
writer = lucene.IndexWriter(path_index4,analyzer,True)
|
| - |
|
79 |
|
| - |
|
80 |
phones = da.get_allbabuchakphones()
|
| - |
|
81 |
for p in phones:
|
| - |
|
82 |
doc = lucene.Document()
|
| - |
|
83 |
id = p.id
|
| - |
|
84 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
85 |
name = p.name
|
| - |
|
86 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| - |
|
87 |
price = p.final_price
|
| - |
|
88 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
89 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| - |
|
90 |
writer.addDocument(doc)
|
| - |
|
91 |
#print str(writer.docCount())
|
| - |
|
92 |
writer.close()
|
| - |
|
93 |
|
| - |
|
94 |
path_index5 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "naaptolindex"
|
| - |
|
95 |
#Create the Index Writer
|
| - |
|
96 |
writer = lucene.IndexWriter(path_index5,analyzer,True)
|
| - |
|
97 |
|
| - |
|
98 |
phones = da.get_allnaaptolphones()
|
| - |
|
99 |
for p in phones:
|
| - |
|
100 |
doc = lucene.Document()
|
| - |
|
101 |
id = p.id
|
| - |
|
102 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
103 |
name = p.name
|
| - |
|
104 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| - |
|
105 |
price = p.range
|
| - |
|
106 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
107 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| - |
|
108 |
writer.addDocument(doc)
|
| - |
|
109 |
#print str(writer.docCount())
|
| - |
|
110 |
writer.close()
|
| - |
|
111 |
|
| - |
|
112 |
|
| - |
|
113 |
path_index6 = ds+"home"+ds+"gaurav"+ds+"code" + ds + "mobstoreindex"
|
| - |
|
114 |
#Create the Index Writer
|
| - |
|
115 |
writer = lucene.IndexWriter(path_index6,analyzer,True)
|
| - |
|
116 |
|
| - |
|
117 |
phones = da.get_allmobstorephones_new()
|
| - |
|
118 |
for p in phones:
|
| - |
|
119 |
doc = lucene.Document()
|
| - |
|
120 |
id = p.id
|
| - |
|
121 |
doc.add(lucene.Field("ID",str(id),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
122 |
name = p.name
|
| - |
|
123 |
doc.add(lucene.Field("name",name,lucene.Field.Store.YES,lucene.Field.Index.TOKENIZED))
|
| - |
|
124 |
price = p.final_price
|
| - |
|
125 |
doc.add(lucene.Field("price",str(price),lucene.Field.Store.YES,lucene.Field.Index.NO))
|
| - |
|
126 |
#print "id " + str(doc.getField("ID")) + " name " + str(doc.getField("name")) + " price " + str(doc.getField("price"))
|
| - |
|
127 |
writer.addDocument(doc)
|
| - |
|
128 |
#print str(writer.docCount())
|
| 43 |
writer.close()
|
129 |
writer.close()
|
| 44 |
|
130 |
|