[Zope] Re: ZCatalog query

Casey Duncan casey at zope.com
Fri Aug 6 15:13:29 EDT 2004


If you are always searching for whole segments, then this is doable. If
this is always a prefix search (which it is in your example) then you
should be able to use a range search of the form::

  path = '/some/path'
  catalog({'url':[path, path + '/\x7F'] 'range':'min max'})

If you want to be able match any path segment, Then you need to populate
the index differently. So long as you want to match whole segments of
the path, this should still perform reasonably.

For the path '/my/obj/path' you would index the following values::

  '/my/obj/path'
  'my/obj/path'
  'obj/path'
  'path'

With those values indexed you should be able to use the same range
search above to find objects that match a particular subpath.

hth,

-Casey

On 06 Aug 2004 11:58:06 UT
jens.walte at kk.net wrote:

> Hello,
> i search for a possibility to query a catalog like this:
> 
> catalog({'meta_type':myobjecttype,
>          [x for x in 'keyword-index' if x.find(mysubstring) != -1]})
> 
> Description:
> there is a metadata (keyword index) for urls in my catalog
> and i have to know the catalogentries with a matching substring in
> this keyword-index
> 
> Example:
> catalog-entry1 -> ['/abc/def/123', '/ghi/123']
> catalog-entry2 -> ['/ghi/123', '/abc']
> catalog-entry3 -> ['/xyz/def/123', '/ghi/123']
> and i search with '/abc' and wanna get entry1 and entry2
> 
> a simple iteration over all results (only filtered by meta_type) is
> much too slow!
> 
> regards
> jens walte
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 



More information about the Zope mailing list