Reg. updating catalog indexes in bluebream
Hello all, I did the following while adding a new site sm = site.getSiteManager() intids = IntIds() sm['intids'] = intids sm.registerUtility(intids, IIntIds) cat = Catalog() sm['catalog'] = cat sm.registerUtility(cat, ICatalog) cat[u'client_name'] = TextIndex('name', IClient) I ran into the debug shell prompt and checked the length of sm['initid'] after adding 'Client' objects via browser interface. It did reflected the number of items added. But when I ran a search query in the shell prompt there were no results >>> len(sm['intids']) 4 >>> list(cat.apply({'client_name': 'xyz*'})) [] But when I updated the indexes, it gave out results. >>> cat.updateIndexes() >>> list(cat.apply({'client_name': 'xyz*'})) [753759381] I guess that I don't have to manually update the indexes each time when an object is added/modified. Am I missing something? -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Am 23.06.2011, 14:43 Uhr, schrieb Joshua Immanuel <josh@hipro.co.in>:
I guess that I don't have to manually update the indexes each time when an object is added/modified. Am I missing something?
The indices do have to be updated every time you add, delete or modify an object. This is one of the reasons for the event system you were asking about the other week. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226
Hello all, Thanks for replying. On Thu, 2011-06-23 at 17:19 +0200, Charlie Clark wrote:
The indices do have to be updated every time you add, delete or modify an object. This is one of the reasons for the event system you were asking about the other week.
As the size of sm['intids'] were getting incremented as and when new objects were added, without me doing anything explicitly about it. I was of the notion that I don't need to explicitly update the indexes. If I subscribe for 'IContainerModifiedEvent' for the container of 'Client' object and update the indexes, then I think I'll miss out if just the attributes of 'Client' object is modified. So, I think along with this I should subscribe for 'IObjectModifiedEvent' of 'Client' object. Will this be sufficient? Is there any other better way of doing this? -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
participants (2)
-
Charlie Clark -
Joshua Immanuel