problem with querying a catalog
Hi, I have some trouble querying a catalog. This DTML works. It get's only the edf objects in the path. <dtml-in expr="dfcatalog(meta_type='edf', path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')"> <a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in> This Python script doesn't work. It returns ALL the edf objects on the site. zcat=container.dfcatalog results=zcat({'query' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'}) Thoughts? Henny
you do not indicate whath index to use for the path. Robert Henny van der Linde wrote:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')"> <a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on the site.
zcat=container.dfcatalog results=zcat({'query' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'})
Thoughts?
Henny
_______________________________________________ Zope maillist - Zope@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 )
robert rottermann wrote:
you do not indicate whath index to use for the path. Robert
Henny van der Linde wrote:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')">
<a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on the site.
zcat=container.dfcatalog results=zcat({'query' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ
e':'edf'})
results=zcat({'path' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_type':'edf'}) should work. Michael
----- Original Message ----- From: "Michael Haubenwallner" <michael@d2m.at> To: <zope@zope.org> Sent: Thursday, August 26, 2004 8:37 AM Subject: [Zope] Re: problem with querying a catalog
robert rottermann wrote:
you do not indicate whath index to use for the path. Robert
Henny van der Linde wrote:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')">
<a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on the site.
zcat=container.dfcatalog results=zcat({'query' :
'/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ
e':'edf'})
results=zcat({'path' :
'/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'})
should work.
Michael
No it doesn't. I tried that before. Henny
----- Original Message ----- From: "Henny van der Linde (zettai)" <linde@inline-info.nl> To: <zope@zope.org>; "Michael Haubenwallner" <michael@d2m.at> Sent: August 26, 2004 2:35 PM Subject: Re: [Zope] Re: problem with querying a catalog
----- Original Message ----- From: "Michael Haubenwallner" <michael@d2m.at> To: <zope@zope.org> Sent: Thursday, August 26, 2004 8:37 AM Subject: [Zope] Re: problem with querying a catalog
robert rottermann wrote:
you do not indicate whath index to use for the path. Robert
Henny van der Linde wrote:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')">
<a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on
the
site.
zcat=container.dfcatalog results=zcat({'query' :
'/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ
e':'edf'})
results=zcat({'path' :
'/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ
e':'edf'})
should work.
Michael
No it doesn't. I tried that before.
Henny
Have you tried: zcat=container.dfcatalog results=zcat.searchResults({'path' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'}) This assumes that 'zcat' is a ZCatalog and that 'path' and 'meta_type' are indexes you have set up. Jonathan
Hi, Am Do, den 26.08.2004 schrieb Jonathan Hobbs um 21:17: ...
Have you tried:
zcat=container.dfcatalog results=zcat.searchResults({'path' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'})
with other words: zcat() and zcat.searchResults() are equivalent :-) zcat.search() has a different call signature :-) Regards Tino
Hi, To all who respondend. Thanks I made two stupid errors. First I didn't have a path index defined. Second the dtml worked the same as the python script, I will not get in the gritty details. ;) Henny
Hi, Am Do, den 26.08.2004 schrieb Henny van der Linde um 4:37:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')"> <a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on the site.
zcat=container.dfcatalog results=zcat({'query' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'})
Why "path" in the dtml example but "query" in the python script example? Different arguments to the same method can produce different results :-) Regards Tino
Am Do, den 26.08.2004 schrieb Henny van der Linde um 4:37:
Hi,
I have some trouble querying a catalog.
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf',
path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms')">
<a href="&dtml-absolute_url;"><dtml-var title></a> </dtml-in>
This Python script doesn't work. It returns ALL the edf objects on the
site.
zcat=container.dfcatalog results=zcat({'query' :
'/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ
e':'edf'})
Why "path" in the dtml example but "query" in the python script example? Different arguments to the same method can produce different results :-)
The dtml is an example I picked from the net. The python script is in the Zope book while using records. However this: zcat=container.dfcatalog results=zcat({'path' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'}) won't work either. Henny .
Hi, Am Do, den 26.08.2004 schrieb Henny van der Linde (zettai) um 20:37: ...
This DTML works. It get's only the edf objects in the path.
<dtml-in expr="dfcatalog(meta_type='edf', path='/... )
...
The python script is in the Zope book while using records. However this:
zcat=container.dfcatalog results=zcat({'path' : '/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms','meta_typ e':'edf'})
won't work either.
Well. You still use different interfaces :-) Why not in the python script use _the same_ expression? After all, its the very same object and so the same interface like in the DTML example :-)) Python Script: results=container.dfcatalog(meta_type='edf',path='/avin/literatuur/antroposofische_literatuur/artikelendatabase/ms') See the identity? :) See also Zope Book API description. Or the source of ZCatalog: 625 def searchResults(self, REQUEST=None, used=None, **kw): 626 """Search the catalog 627 628 Search terms can be passed in the REQUEST or as keyword 629 arguments. 630 631 The used argument is now deprecated and ignored 632 """ 633 634 return self._catalog.searchResults(REQUEST, used, **kw) 635 636 __call__=searchResults 637 638 def search( 639 self, query_request, sort_index=None, reverse=0, limit=None,merge=1): 640 """Programmatic search interface, use for searching the catalog from 641 scripts. 642 643 query_request: Dictionary containing catalog query 644 sort_index: Name of sort index 645 reverse: Reverse sort order? 646 limit: Limit sorted result count (optimization hint) 647 merge: Return merged results (like searchResults) or raw 648 results for later merging. 649 """ Regards Tino
participants (6)
-
Henny van der Linde -
Henny van der Linde (zettai) -
Jonathan Hobbs -
Michael Haubenwallner -
robert rottermann -
Tino Wildenhain