Exemplo n.º 1
0
 def setUp(self):
   app= Application()
   catalog= ZCatalog('Catalog')
   app._setObject('Catalog',catalog)
   self.catalog= catalog= app._getOb('Catalog')
   install_products(app, 'ManagableIndex')
   # field
   self.fi = self._createIndex('id', FieldIndex)
   # keyword
   self.ki= self._createIndex('kw', KeywordIndex)
   # range
   self.ri = self._createIndex(
     'ri', RangeIndex,
     dict(CombineType='aggregate',
          ValueProviders=[
            dict(id='rlow', type='AttributeLookup'),
            dict(id='rhigh', type='AttributeLookup'),
            ]
          ),
     )
   # word
   lexicon = Lexicon(Splitter())
   app._setObject('lexicon', lexicon)
   self.wi = self._createIndex('wi', WordIndex, dict(Lexicon='lexicon'))
   # simple text
   self.sti = self._createIndex('sti', SimpleTextIndex, dict(Lexicon='lexicon'))
   # path
   self.pi= self._createIndex('pi', PathIndex)
   # create objects
   self.obj1= obj1= _Object()
   obj1.kw= (1,2)
   obj1.fkw= _Caller(lambda obj: obj.kw)
   obj1.fid= _Caller(lambda obj: obj.id)
   self.obj2= obj2= _Object().__of__(obj1)
   obj2.id= 'id'
Exemplo n.º 2
0
 def setUp(self):
     app = Application()
     catalog = ZCatalog('Catalog')
     app._setObject('Catalog', catalog)
     self.catalog = catalog = app._getOb('Catalog')
     install_products(app, 'ManagableIndex')
     # field
     self.fi = self._createIndex('id', FieldIndex)
     # keyword
     self.ki = self._createIndex('kw', KeywordIndex)
     # range
     self.ri = self._createIndex(
         'ri',
         RangeIndex,
         dict(CombineType='aggregate',
              ValueProviders=[
                  dict(id='rlow', type='AttributeLookup'),
                  dict(id='rhigh', type='AttributeLookup'),
              ]),
     )
     # word
     lexicon = Lexicon(Splitter())
     app._setObject('lexicon', lexicon)
     self.wi = self._createIndex('wi', WordIndex, dict(Lexicon='lexicon'))
     # simple text
     self.sti = self._createIndex('sti', SimpleTextIndex,
                                  dict(Lexicon='lexicon'))
     # path
     self.pi = self._createIndex('pi', PathIndex)
     # create objects
     self.obj1 = obj1 = _Object()
     obj1.kw = (1, 2)
     obj1.fkw = _Caller(lambda obj: obj.kw)
     obj1.fid = _Caller(lambda obj: obj.id)
     self.obj2 = obj2 = _Object().__of__(obj1)
     obj2.id = 'id'
 def setUp(self):
   app= Application()
   catalog= ZCatalog('Catalog')
   app._setObject('Catalog',catalog)
   self.catalog= catalog= app._getOb('Catalog')
   # create indexes -- avoid the official API because it requires
   # product setup and this takes ages
   cat= catalog._catalog
   # field
   fi= FieldIndex('id'); cat.addIndex('id',fi)
   self.fi= cat.getIndex('id')
   # keyword
   ki= KeywordIndex('kw'); cat.addIndex('kw',ki)
   self.ki= cat.getIndex('kw')
   # range
   ri= RangeIndex('ri'); cat.addIndex('ri',ri)
   self.ri = ri = cat.getIndex('ri')
   ri._delObject('ri'); ri.CombineType = 'aggregate'
   ri.addValueProvider('rlow','AttributeLookup')
   ri.addValueProvider('rhigh','AttributeLookup')
   # word
   lexicon = Lexicon(Splitter())
   app._setObject('lexicon', lexicon)
   wi = WordIndex('wi'); cat.addIndex('wi',wi)
   wi.Lexicon = 'lexicon'
   self.wi = cat.getIndex('wi')
   # path
   pi= PathIndex('pi'); cat.addIndex('pi',pi)
   self.pi= cat.getIndex('pi')
   # create objects
   self.obj1= obj1= _Object()
   obj1.kw= (1,2)
   obj1.fkw= _Caller(lambda obj: obj.kw)
   obj1.fid= _Caller(lambda obj: obj.id)
   self.obj2= obj2= _Object().__of__(obj1)
   obj2.id= 'id'