#NEWLINE# def __init__( self , document , use_term_index = True ) : #NEWLINE# #INDENT# self . document = document #NEWLINE# index_meta = { #NEWLINE# #INDENT# 'allow_inheritance' : False , #NEWLINE# 'collection' : ( '%sindex' % document . _meta [ 'collection' ] ) , #NEWLINE# #UNINDENT# } #NEWLINE# if use_term_index : #NEWLINE# #INDENT# index_meta [ 'indexes' ] = [ 'terms.term' ] #NEWLINE# #UNINDENT# class DocumentIndex ( Document ) : #NEWLINE# #INDENT# doc_id = fields . StringField ( primary_key = True ) #NEWLINE# terms = fields . ListField ( fields . EmbeddedDocumentField ( SearchTerm ) ) #NEWLINE# length = fields . IntField ( ) #NEWLINE# meta = index_meta #NEWLINE# #UNINDENT# self . document_index = DocumentIndex #NEWLINE# self . fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# }