Re: [Zope3-Users] Catalog for newbies

2005-12-13 Thread Stephan Richter
On Thursday 08 December 2005 10:56, Frank Burkhardt wrote:
 How do I use adapters in python? I've got an object implementing interface
 'IFoo'. How to I turn it into an object implementing 'IBar'?

Pretty much all introductory documentation for Zope 3 will talk about this, 
including the txt files in zope.interface and zope.component.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Catalog for newbies

2005-12-06 Thread Jeff Shell
On 12/6/05, Frank Burkhardt [EMAIL PROTECTED] wrote:
 Hi,

 after adding a Unique Id utility, Catalog and some field + text indices
 I successfully added documents which seem to be added to the catalog
 (as shown in the catalog's Advanced-tab).

 However I've got two question now:

 1. How do I search the catalog?

Querying the catalog directly is kindof a pain right now, as the
indexes have their own 'query' syntax. I'd recommend checking out
'hurry.query' which makes building queries easier:

http://faassen.n--tree.net/blog/view/weblog/2005/09/09/0

But to query directly, you can basically do this in a view:

catalog = zapi.getUtility(ICatalog, 'catalog', self.context)
results = self._results = catalog.searchResults(textindexname='text to
search for', fieldindexname=('low value', 'high value'))

and so on, with 'textindexname' and 'fieldindexname' being the names
of the indexes you're searching for. For field indexes, you have to
specify a 'low' and 'high' value in the tuple. This surprised me when
I was doing catalog work a few months ago before we started using
hurry.query - I thought I could do a search like ``section='winter'``
to get all documents in the 'winter' section of the site. That worked
fine. But when we added 'summer' to the site and I did
``section='summer'``, winter documents showed up too! What happened is
that when only one value is passed into the field index for querying,
it's thought that the high value is open. Since 'winter'  'summer',
the winter documents were being returned in my summer query, but not
the other way around. So a field index query is a range. If you want
items that match a single value like I did, you have to do something
like ``section=('summer', 'summer')``.

With 'hurry.query' you can build complex queries more easily.

 2. Documents are added to the index only when they are added to the ZODB.
Is there a Way to scan the entire ZODB to index all objects
matching the indices interface constraints?

On the 'Advanced' tab for the catalog in the default skin(s) there is
a 'Reindex' button which will rebuild all of the indices based on
their configuration.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Catalog for newbies

2005-12-06 Thread Alen Stanisic
Hi Frank

On Tue, 2005-12-06 at 14:36 +0100, Frank Burkhardt wrote:

[...]

 2. Documents are added to the index only when they are added to the ZODB.
Is there a Way to scan the entire ZODB to index all objects
matching the indices interface constraints?

ZODB objects created before Unique Id utility was created will not be
indexed and you will have to write a small program to manually index
them.

Alen

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users