[Zope] struggling a bit with querying a catalog

Jonathan Hobbs toolkit at magma.ca
Mon Aug 23 20:54:32 EDT 2004


----- Original Message -----
From: "Henny van der Linde" <linde at inline-info.nl>
> This snippet works:
>
> zcat=context.litcatalog
> results=zcat({'query' : '/habraken/documenten/dftest','level' : 0})
> return results
>
> Can I combine this (path index query) query with a ZCTextIndex with
searches
> for a certain phrasein a certain field?
>
> If so, can any point to the right syntax?

If you have created an index for your 'certain field' as a ZCTextIndex
(don't forget to set up the lexicon) then you should just be able to add the
search in the same query:

results=zcat({'query' : '/habraken/documenten/dftest','level' : 0,
'textindexfield' : 'searchphrase'})

To make the search more useful you can substitute a variable for the
hardcoded search phrase in the above example.

searchvar = 'searchphrase'
results=zcat({'query' : '/habraken/documenten/dftest','level' : 0,
'textindexfield' : searchvar})


Jonathan




More information about the Zope mailing list