[Zope-dev] Reg. updating catalog indexes in bluebream

Joshua Immanuel josh at hipro.co.in
Thu Jun 23 08:43:01 EDT 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20110623/5fefb565/attachment.bin 


More information about the Zope-Dev mailing list