Can you add a field introduced by schemaextender as a catalog column?

8 messages Options
Embed this post
Permalink
AnthonyG () Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
Hi,

I've added a field to news items using archetypes.schemaextender and I'd like to add it as a column to my site's catalog.  When I try this is doesn't seem to have any effect.  Catalog brains return type "Missing" when I try to access the new column.  I've tried re-indexing all my indices and also updating news items TTW after adding the column and now I'm wondering whether this is even possible.  

We're using Plone 3.3.1 and archetypes.schemaextender 1.1.

Thanks in advance

Anthony
ajung () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
Try to write an method getFoo() return the related value to be indexed
and attach it to the original class
(e.g. using dm.reuse). Then try to add an index called 'getFoo'.

-aj

AnthonyG wrote:
Hi,

I've added a field to news items using archetypes.schemaextender and I'd like to add it as a column to my site's catalog.  When I try this is doesn't seem to have any effect.  Catalog brains return type "Missing" when I try to access the new column.  I've tried re-indexing all my indices and also updating news items TTW after adding the column and now I'm wondering whether this is even possible.  

We're using Plone 3.3.1 and archetypes.schemaextender 1.1.

Thanks in advance

Anthony
Bastien Gauthier () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
I do not know if it helps but do not forget that the default accessor to an attribute with AT is "getMyAttribute", so, if you added a metadata, add it like "getMyAttribute" and not "myAttribute"...

Have a nice day,

BASTIEN Gauthier
Service Informatique - Administration Communale de Sambreville
071/260.247
http://www.sambreville.be
 

>-----Message d'origine-----
>De : ajung [mailto:[hidden email]]
>Envoyé : mardi 3 novembre 2009 11:00
>À : [hidden email]
>Objet : Re: [Plone-Users] Can you add a field introduced by
>schemaextender as a catalog column?
>
>
>Try to write an method getFoo() return the related value to be
>indexed and attach it to the original class (e.g. using
>dm.reuse). Then try to add an index called 'getFoo'.
>
>-aj
>
>
>AnthonyG wrote:
>>
>> Hi,
>>
>> I've added a field to news items using archetypes.schemaextender and
>> I'd like to add it as a column to my site's catalog.  When I
>try this
>> is doesn't seem to have any effect.  Catalog brains return
>type "Missing"
>> when I try to access the new column.  I've tried re-indexing all my
>> indices and also updating news items TTW after adding the column and
>> now I'm wondering whether this is even possible.
>>
>> We're using Plone 3.3.1 and archetypes.schemaextender 1.1.
>>
>> Thanks in advance
>>
>> Anthony
>>
>
>--
>View this message in context:
>http://n2.nabble.com/Can-you-add-a-field-introduced-by-schemaex
>tender-as-a-catalog-column-tp3937077p3937495.html
>Sent from the General Questions mailing list archive at Nabble.com.
>
>---------------------------------------------------------------
>---------------
>Come build with us! The BlackBerry(R) Developer Conference in
>SF, CA is the only developer event you need to attend this
>year. Jumpstart your developing skills, take BlackBerry mobile
>applications to market and stay ahead of the curve. Join us
>from November 9 - 12, 2009. Register now!
>http://p.sf.net/sfu/devconference
>_______________________________________________
>Plone-Users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/plone-users
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
ajung () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
Sorry, that's nonsense. Fields introduced using at.schemaextender have *NO* such auto-generated methods.

-aj
Bastien Gauthier wrote:
I do not know if it helps but do not forget that the default accessor to an attribute with AT is "getMyAttribute", so, if you added a metadata, add it like "getMyAttribute" and not "myAttribute"...
AnthonyG () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
In reply to this post by ajung
Indexing works OK.  I've attached an index to my new field and catalog searches for that index work fine.  What doesn't work is retrieving metadata from the catalog column.

e.g. Below just a set of blank lines from 'Missing' type are output

for brain in catalog(myField = someValue):
    # some results returned
    print brain.myField

I have both an index (portal_catalog/Indexes) and a column (portal_catalog/Metadata) set-up for the new field.  Will the approach below will work for retrieving the metadata as well?

ajung wrote:

> Try to write an method getFoo() return the related value to be indexed
> and attach it to the original class
> (e.g. using dm.reuse). Then try to add an index called 'getFoo'.
>
> -aj
>
>
> AnthonyG wrote:
>> Hi,
>>
>> I've added a field to news items using archetypes.schemaextender and I'd
>> like to add it as a column to my site's catalog.  When I try this is
>> doesn't seem to have any effect.  Catalog brains return type "Missing"
>> when I try to access the new column.  I've tried re-indexing all my
>> indices and also updating news items TTW after adding the column and now
>> I'm wondering whether this is even possible.  
>>
>> We're using Plone 3.3.1 and archetypes.schemaextender 1.1.
>>
>> Thanks in advance
>>
>> Anthony
>>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Bastien Gauthier () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
In reply to this post by ajung
Oups! ;-)

Thank you very much for the information, I never used atschemaextender...

Sorry for the inconvenience,

BASTIEN Gauthier
Service Informatique - Administration Communale de Sambreville
071/260.247
http://www.sambreville.be
 

>-----Message d'origine-----
>De : ajung [mailto:[hidden email]]
>Envoyé : mardi 3 novembre 2009 11:20
>À : [hidden email]
>Objet : Re: [Plone-Users] Can you add a field introduced by
>schemaextender as a catalog column?
>
>
>Sorry, that's nonsense. Fields introduced using
>at.schemaextender have *NO* such auto-generated methods.
>
>-aj
>
>Bastien Gauthier wrote:
>>
>> I do not know if it helps but do not forget that the default
>accessor
>> to an attribute with AT is "getMyAttribute", so, if you added a
>> metadata, add it like "getMyAttribute" and not "myAttribute"...
>>
>>
>>
>
>--
>View this message in context:
>http://n2.nabble.com/Can-you-add-a-field-introduced-by-schemaex
>tender-as-a-catalog-column-tp3937077p3937562.html
>Sent from the General Questions mailing list archive at Nabble.com.
>
>---------------------------------------------------------------
>---------------
>Come build with us! The BlackBerry(R) Developer Conference in
>SF, CA is the only developer event you need to attend this
>year. Jumpstart your developing skills, take BlackBerry mobile
>applications to market and stay ahead of the curve. Join us
>from November 9 - 12, 2009. Register now!
>http://p.sf.net/sfu/devconference
>_______________________________________________
>Plone-Users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/plone-users
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Martin Aspeli () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
In reply to this post by AnthonyG
AnthonyG wrote:

> Hi,
>
> I've added a field to news items using archetypes.schemaextender and I'd
> like to add it as a column to my site's catalog.  When I try this is doesn't
> seem to have any effect.  Catalog brains return type "Missing" when I try to
> access the new column.  I've tried re-indexing all my indices and also
> updating news items TTW after adding the column and now I'm wondering
> whether this is even possible.  
>
> We're using Plone 3.3.1 and archetypes.schemaextender 1.1.

Use plone.indexer to write a custom indexer that does something like


   return context.Schema()['myfield'].get(context)

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
AnthonyG () Re: Can you add a field introduced by schemaextender as a catalog column?
Reply Threaded More More options
Print post
Permalink
Thanks for everyone's responses.  I opted for Martin's approach as plone.indexer is included in Plone 3.3 and it worked a treat.

Anthony

Martin Aspeli wrote:

> AnthonyG wrote:
>> Hi,
>>
>> I've added a field to news items using archetypes.schemaextender and I'd
>> like to add it as a column to my site's catalog.  When I try this is doesn't
>> seem to have any effect.  Catalog brains return type "Missing" when I try to
>> access the new column.  I've tried re-indexing all my indices and also
>> updating news items TTW after adding the column and now I'm wondering
>> whether this is even possible.  
>>
>> We're using Plone 3.3.1 and archetypes.schemaextender 1.1.
>
> Use plone.indexer to write a custom indexer that does something like
>
>
>    return context.Schema()['myfield'].get(context)
>
> Martin
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users