[Zope] ZCTextIndex - prefix wildcards not supported?

Small Business Services toolkit at magma.ca
Mon Jun 21 10:37:18 EDT 2004


From: "Casey Duncan" <casey at zope.com>
> On Mon, 21 Jun 2004 09:49:00 -0400
> "Small Business Services" <toolkit at magma.ca> wrote:
>
> > Hi Casey,
> >
> > I am trying to implement your suggestion of accessing the '_docwords'
> > structure in an attempt to eliminate duplicate storage of data in the
> > ZCatalog.
> >
> > I have created a test external method to retrieve the _docwords entry
> > for a specific object in an existing ZCatalog:
> >
> > def jtmp(self):
> >    res = self.Catalog({'id' : '1086793690.85'})
> >    for item in res:
> >       rid = item.data_record_id_
> >    return
> > self.Catalog.getIndex('all_searchable_text').getEntryForObject(rid)
>
> Catalog is a ZCatalog instance, (not a Catalog instance) so it doesn't
> have getIndex. One of these two should work:
>
> idx = self.Catalog.Indexes['all_searchable_text']
>
> or
>
> idx = self.Catalog._catalog.getIndex('all_searchable_text')

Thanks Casey!  The second option solved the problem:

return
self.Catalog._catalog.getIndex('all_searchable_text').getEntryForObject(rid)

Works like a charm!


Jonathan







More information about the Zope mailing list