Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3232 varun.gupt 1
'''
2
Created on 30-Aug-2011
3
 
4
@author: Varun Gupta
5
'''
6
from lucene import Document, Field
7
 
8
class PhonePriceDoc(Document):
9
    '''
10
    Represents name, price and other details of a handset 
11
    '''
12
 
13
    def __init__(self, phone_price):
14
        Document.__init__(self)
15
        print phone_price['name'], phone_price['source'], phone_price['price'], phone_price['in_stock'], phone_price['url']
16
 
17
        self.add(Field("name", str(phone_price['name']), Field.Store.YES, Field.Index.ANALYZED))
18
        self.add(Field("source", str(phone_price['source']), Field.Store.YES, Field.Index.ANALYZED))
19
        self.add(Field("price", str(phone_price['price']), Field.Store.YES, Field.Index.ANALYZED))
20
        self.add(Field("in_stock", str(phone_price['in_stock']), Field.Store.YES, Field.Index.NO))
21
        self.add(Field("url", str(phone_price['url']), Field.Store.YES, Field.Index.NO))
22