Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

'''
Created on 30-Aug-2011

@author: Varun Gupta
'''
from lucene import Document, Field

class PhonePriceDoc(Document):
    '''
    Represents name, price and other details of a handset 
    '''
    
    def __init__(self, phone_price):
        Document.__init__(self)
        print phone_price['name'], phone_price['source'], phone_price['price'], phone_price['in_stock'], phone_price['url']
                                  
        self.add(Field("name", str(phone_price['name']), Field.Store.YES, Field.Index.ANALYZED))
        self.add(Field("source", str(phone_price['source']), Field.Store.YES, Field.Index.ANALYZED))
        self.add(Field("price", str(phone_price['price']), Field.Store.YES, Field.Index.ANALYZED))
        self.add(Field("in_stock", str(phone_price['in_stock']), Field.Store.YES, Field.Index.NO))
        self.add(Field("url", str(phone_price['url']), Field.Store.YES, Field.Index.NO))