-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stefano Guglia wrote: > Hello everybody.. > > I have to index some data from a mysql query recordset and all works OK > but..I added a keywordIndex to store (with the same url) multiple values > related to the above recordset. > It seems I cannot use brains (query results are strings). > > Probably a newbie question, but I really do not know how to update a > keywordIndex starting from a list..Any help (+sample code pls :-)) ?
If you have a KeywordIndex for the attribute 'foo', then you need to arrange that the reult objects in your recordset have sequences for the column / atrribute 'foo'. E.g., for a query like: select bar.id as 'bar, bar.name as 'name', foo.name as 'foo from bar, foo where foo.bar_id = bar.id you need to transform the result set: bars = {} for row in rows: bar_id= row['bar'] bar = bars.get(bar_id) if bar is None: bar = bars[bar_id[ = {'bar': bar_id, 'name': row['name'], 'foo': [], } bar['foo'].append(row['foo']) *Now* you can index the records you have transformed: for bar in bars.values(): catalog.indexObject(compute_uid(bar), make_record(bar)) Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFHxEcP+gerLs4ltQ4RAil1AKCnONzwX4/GKMQKx5WP6twE30p4rwCY4Q9X V2jWkrjSZcDbyXqk0JUgqA== =1zLd -----END PGP SIGNATURE----- _______________________________________________ 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 )