[Plone-IT] esempio di indice keyword per catalogare oggetti
Yuri
yurj a alfa.it
Lun 10 Mar 2008 09:18:32 UTC
Presa dalla mailing list di Zope, magari interessa a qualcuno :P
===
I think you need to give us a script to reproduce the behavior you are
seeing, e.g.:
1. In a folder, create a ZCatalog instance, 'catalog'.
2. On the catalog's "Indexes" tab, add a FieldIndex named 'access'
(or try it with a Keyword index instead).
3. Create the following DTMLDocuments in the folder, each with the
specified value for a lines property called 'access'::
Document ID access list
----------- ------------
'foo' ('baz',)
'qux' ('bam', 'baz')
'splift' ('bar', 'baz')
4. On the catalog's "Find Objects" tab, index the documents.
5. Add a PythonScript, 'show_me' to the folder, with the following
body::
catalog = context.catalog
for access_value in ('baz',
('baz',),
('bam', 'baz'),
('bar', 'baz')):
print 'Querying value for access:', access_value
brains = catalog.searchResults(access={'query': access_value,
'operator': 'and'})
for brain in brains:
print brain.getPath()
print
return printed
=====
Notare l'utilizzo dell'and, di default è or.
Maggiori informazioni sulla lista
Plone-IT