def create_catalog(self): catalog = Catalog() catalog[u'user'] = FieldIndex(field_name='user', field_callable=False) catalog[u'text'] = TextIndex(field_name='text', field_callable=False) catalog[u'keywords'] = KeywordIndex(field_name='keywords', field_callable=False) return catalog
def setup_catalog(): catalog = Catalog() catalog['date'] = FieldIndex('date', IBooking, False) catalog['text'] = TextIndex('text', IBooking, False) catalog['owner'] = FieldIndex('owner', IBooking, False) catalog['references'] = KeywordIndex('index_references', IBooking, True) catalog['tags'] = KeywordIndex('tags', IBooking, False) return catalog
def setUp(self): """emulate the doctest fixtures""" self.intid = DummyIntId() provideUtility(self.intid, zope.intid.interfaces.IIntIds) self.catalog = Catalog() provideUtility(self.catalog, ICatalog, 'catalog1') self.catalog['f1'] = FieldIndex('f1', IContent) self.catalog['f2'] = FieldIndex('f2', IContent) self.catalog['f3'] = FieldIndex('f3', IContent) self.catalog['f4'] = FieldIndex('f4', IContent) self.catalog['t1'] = TextIndex('t1', IContent) self.catalog['t2'] = TextIndex('t2', IContent) provideUtility(query.Query(), IQuery) self.setup_content()
def _createCatalog(self, site): """Create the catalog if needed and return it. If the catalog already exists, return that. """ catalog = zope.component.queryUtility(ICatalog, name=self.catalog_name, context=site, default=None) if catalog is not None: return catalog catalog = Catalog() setupUtility = zope.component.getUtility( grokcore.site.interfaces.IUtilityInstaller) setupUtility(site, catalog, ICatalog, name=self.catalog_name) return catalog
def __call__(self): catalog = Catalog() catalog[u'date'] = FieldIndex(field_name='date', field_callable=False) return catalog
def create_catalog(self): catalog = Catalog() catalog[u'ting'] = TingIndex(field_name=('foo', 'bar', 'baz'), field_callable=False) return catalog