Discussion:
[Erp5-dev] search for email fast (portal_catalog?)
Bartek Gorny
2006-03-20 12:47:34 UTC
Permalink
Hello

I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?

I'm afraid that doing such search by searching all emails and then
iterating to check each of them for url_string will be disastrous in
terms of performance, when the database grows, so I'd prefer to use
sql for it.

Bartek
Yoshinori Okuji
2006-03-20 12:57:26 UTC
Permalink
Post by Bartek Gorny
I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?
This is a good question. The usual way is to add "url_string" to the catalog
table (or a new table). But it might be better to change the property to
"reference", since an URL is a kind of reference in the ERP5 concept.

What do others think about this?

YO
--
Yoshinori Okuji, Nexedi Research Director
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://wiki.erp5.org
Jérôme Perrin
2006-03-21 17:33:41 UTC
Permalink
Post by Yoshinori Okuji
Post by Bartek Gorny
I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?
This is a good question. The usual way is to add "url_string" to the
catalog table (or a new table). But it might be better to change the
property to "reference", since an URL is a kind of reference in the ERP5
concept.
What do others think about this?
Originally, email address were available to catalog using SearchableText from
compatiblity table, but currently this table is disabled by default.

So one solution could be to enable the compatibility table as described in
rafael's howto
http://www.erp5.org/sections/documentation/howto/howto_create_a_full/view

and do a search like this :

email_list = context.portal_catalog( portal_type = 'Email',
SearchableText = 'email at domain.net' )
person_list = [email.getObject().getParentValue() for email in email_list]
--
J?rome
Jean-Paul Smets
2006-03-22 20:24:32 UTC
Permalink
Post by Bartek Gorny
Hello
I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?
I'm afraid that doing such search by searching all emails and then
iterating to check each of them for url_string will be disastrous in
terms of performance, when the database grows, so I'd prefer to use
sql for it.
There are 3 ways:
1- add a full text search table and embed email address in SearchableText
2- add a dedicated table for email search
3- add a column to the catalog

1- is the most generic (it is implemented here if you need it
http://cvs.erp5.org/erp5_bt5/erp5_web/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/)
2- is OK because it does not break existing things
3- is only acceptable in case you need to do a lot of search and do not care
breaking standard setup

JPS.
Post by Bartek Gorny
Bartek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
Bartek Gorny
2006-03-23 13:37:44 UTC
Permalink
Post by Jean-Paul Smets
Post by Bartek Gorny
Hello
I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?
I'm afraid that doing such search by searching all emails and then
iterating to check each of them for url_string will be disastrous in
terms of performance, when the database grows, so I'd prefer to use
sql for it.
1- add a full text search table and embed email address in SearchableText
2- add a dedicated table for email search
In case (2), do I have to overwrite the Email.reindexObject method, to
make it run one more zssql method to update also the email table?

Bartek
Post by Jean-Paul Smets
3- add a column to the catalog
1- is the most generic (it is implemented here if you need it
http://cvs.erp5.org/erp5_bt5/erp5_web/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/)
2- is OK because it does not break existing things
3- is only acceptable in case you need to do a lot of search and do not care
breaking standard setup
JPS.
Post by Bartek Gorny
Bartek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
Bartłomiej Górny
2006-03-25 12:53:02 UTC
Permalink
Post by Bartek Gorny
Post by Jean-Paul Smets
Post by Bartek Gorny
Hello
I need to quickly find an email address in ERP5 database - is there a
way to use portal_catalog for it, to search object by url_string
property? Should I add something to portal_catalog settings, or create
an sql method, or what?
I'm afraid that doing such search by searching all emails and then
iterating to check each of them for url_string will be disastrous in
terms of performance, when the database grows, so I'd prefer to use
sql for it.
1- add a full text search table and embed email address in SearchableText
2- add a dedicated table for email search
In case (2), do I have to overwrite the Email.reindexObject method, to
make it run one more zssql method to update also the email table?
Ok, got it - a new wiki page is coming soon :)

Bartek
Post by Bartek Gorny
Bartek
Post by Jean-Paul Smets
3- add a column to the catalog
1- is the most generic (it is implemented here if you need it
http://cvs.erp5.org/erp5_bt5/erp5_web/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/)
2- is OK because it does not break existing things
3- is only acceptable in case you need to do a lot of search and do not care
breaking standard setup
JPS.
Post by Bartek Gorny
Bartek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Loading...