def setUp(self): self._vocabulary = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1) col1 = FieldIndex('col1') col2 = TextIndex('col2') col3 = KeywordIndex('col3') self._catalog = Catalog() self._catalog.addIndex('col1', col1) self._catalog.addIndex('col2', col2) self._catalog.addIndex('col3', col3) self._catalog.addColumn('col1') self._catalog.addColumn('col2') self._catalog.addColumn('col3') att1 = FieldIndex('att1') att2 = TextIndex('att2') att3 = KeywordIndex('att3') num = FieldIndex('num') self._catalog.addIndex('att1', att1) self._catalog.addIndex('att2', att2) self._catalog.addIndex('att3', att3) self._catalog.addIndex('num', num) self._catalog.addColumn('att1') self._catalog.addColumn('att2') self._catalog.addColumn('att3') self._catalog.addColumn('num') for x in range(0, self.upper): self._catalog.catalogObject(dummy(self.nums[x]), ` x `) self._catalog.aq_parent = dummy('foo') # fake out acquisition
def make_old_index(): from Products.PluginIndexes.TextIndex.TextIndex import TextIndex from Products.PluginIndexes.TextIndex.Lexicon import Lexicon from Products.ZCTextIndex.StopDict import get_stopdict l = Lexicon(get_stopdict()) l.SplitterFunc = MySplitter() return TextIndex("read", lexicon=l)
def setUp(self): from Products.PluginIndexes.TextIndex.TextIndex import TextIndex PlacelessSetup.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup.PluginIndexes) self._obj = TextIndex('foo_text') self._XML = _TEXT_XML
def setUp(self): import Products.GenericSetup.PluginIndexes from Products.PluginIndexes.TextIndex.TextIndex import TextIndex NodeAdapterTestCase.setUp(self) zcml.load_config('configure.zcml', Products.GenericSetup.PluginIndexes) self._obj = TextIndex('foo_text') self._XML = _TEXT_XML
def setUp(self): vocabulary = Vocabulary.Vocabulary('Vocabulary', 'Vocabulary', globbing=1) self.catalogs = [] for i in range(3): cat = Catalog() cat.addIndex('num', FieldIndex('num')) cat.addIndex('big', FieldIndex('big')) cat.addIndex('title', TextIndex('title')) cat.vocabulary = vocabulary cat.aq_parent = zdummy(16336) for i in range(10): obj = zdummy(i) obj.big = i > 5 cat.catalogObject(obj, str(i)) self.catalogs.append(cat)
def testDelTextIndex(self): idx = TextIndex('id') self._catalog.addIndex('id', idx) self._catalog.delIndex('id') self.assert_( self._catalog.indexes.has_key('id') != 1, 'del index failed')
def testAddTextIndex(self): idx = TextIndex('id') self._catalog.addIndex('id', idx) i = self._catalog.indexes['id'] te = TextIndex('id', None, None, Lexicon()) self.assert_(isinstance(i, type(te)), 'add text index failed')
def setUp(self): from Products.PluginIndexes.TextIndex.TextIndex import TextIndex NodeAdapterTestCase.setUp(self) self._obj = TextIndex('foo_text') self._XML = _TEXT_XML