People I have a desire to be able to profile my Python Product so that I can benefit from the advantages of profiling. Has anybody done this? Does anybody know how to do this? I have tried profiling Z2.py but of course that doesn't drop down to the level of the python product (Possibly running in a different thread - or something :( ) General Comments Welcomed. Cheers -Andy
On Wed, Feb 07, 2001 at 04:04:24PM +0000, Andy Dawkins wrote:
I have a desire to be able to profile my Python Product so that I can benefit from the advantages of profiling.
Has anybody done this? Does anybody know how to do this?
I have tried profiling Z2.py but of course that doesn't drop down to the level of the python product (Possibly running in a different thread - or something :( )
Have a look at: Control Panel -> Debug Information. There is a 'Profiling' tab that explains what you have to do to switch it on. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ ---------------------------------------------
Martijn Pieters wrote:
Have a look at: Control Panel -> Debug Information. There is a 'Profiling' tab that explains what you have to do to switch it on.
-- Martijn Pieters
Oh my god, That is sooooo sexy :-) Cheers Martijn, I owe you a pint. -Andy
I understand that the search terms for a field with TextIndex are ORed and the fields in a search form are ANDed. But assume the following: * I have three fields (eg. abstract, content, title) with TextIndex * I have one field (eg. category) with FieldIndex When searching I want just give a keyword for the three TextIndex fields and a search term for category. The applying expression should look like this: (abstract=keyword OR content=keyword OR title=keyword) AND category=searchTerm Any hints? Thanks Arno Gross, email: arno.gross@consotec.de
Arno Gross wrote:
I understand that the search terms for a field with TextIndex are ORed and the fields in a search form are ANDed. But assume the following: * I have three fields (eg. abstract, content, title) with TextIndex * I have one field (eg. category) with FieldIndex
When searching I want just give a keyword for the three TextIndex fields and a search term for category. The applying expression should look like this:
(abstract=keyword OR content=keyword OR title=keyword) AND category=searchTerm
Any hints?
Create a method or computed attribute called "search_text" that returns the concatenation of abstract, content and title. In ZPatterns I'd use the following SkinScript: WITH SELF COMPUTE search_text='%s %s %s' % (abstract, content, title) An equivalent PythonScript as a method of your ZClass would be: name: search_text return '%s %s %s' % (container.abstract, container.content, container.title) Use a similar method in a python class, replacing "container" with "self". Set up search_text as a TextIndex in your ZCatalog. Then, query the catalog with something like: Catalog(search_text=keyword_for_query, category=searchTerm) The standard name for the search_text method or attribute is PrincipiaSearchSource. That's why PrincipiaSearchSource is a default TextIndex in a new ZCatalog. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
Hi Steve, maybe I'm missing one step. If I create a TextIndex for search_text (or PrincipiaSearchSource) I have to tell somewhere how this index is composite? Becaus I try to list PrincipiaSearchSource in my result list it's empty. Thanks Arno Gross, email: arno.gross@consotec.de On Thu, 08 Feb 2001, Steve Alexander wrote:
Arno Gross wrote:
I understand that the search terms for a field with TextIndex are ORed and the fields in a search form are ANDed. But assume the following: * I have three fields (eg. abstract, content, title) with TextIndex * I have one field (eg. category) with FieldIndex
When searching I want just give a keyword for the three TextIndex fields and a search term for category. The applying expression should look like this:
(abstract=keyword OR content=keyword OR title=keyword) AND category=searchTerm
Any hints?
Create a method or computed attribute called "search_text" that returns the concatenation of abstract, content and title.
In ZPatterns I'd use the following SkinScript:
WITH SELF COMPUTE search_text='%s %s %s' % (abstract, content, title)
An equivalent PythonScript as a method of your ZClass would be:
name: search_text return '%s %s %s' % (container.abstract, container.content, container.title)
Use a similar method in a python class, replacing "container" with "self".
Set up search_text as a TextIndex in your ZCatalog.
Then, query the catalog with something like:
Catalog(search_text=keyword_for_query, category=searchTerm)
The standard name for the search_text method or attribute is PrincipiaSearchSource. That's why PrincipiaSearchSource is a default TextIndex in a new ZCatalog.
-- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Arno Gross wrote:
Hi Steve, maybe I'm missing one step. If I create a TextIndex for search_text (or PrincipiaSearchSource) I have to tell somewhere how this index is composite? Becaus I try to list PrincipiaSearchSource in my result list it's empty.
You need to provide a method or property or attribute that gives the catalog the concatenated search text. You haven't said what kind of objects you are cataloging: are they ZClass instances, Python class instances, DTML Documents... ? You may be able to use a PythonScript in the acquisition path of your objects to do this work.
On Thu, 08 Feb 2001, Steve Alexander wrote:
Arno Gross wrote:
I understand that the search terms for a field with TextIndex are ORed and the fields in a search form are ANDed. But assume the following: * I have three fields (eg. abstract, content, title) with TextIndex * I have one field (eg. category) with FieldIndex
When searching I want just give a keyword for the three TextIndex fields and a search term for category. The applying expression should look like this:
(abstract=keyword OR content=keyword OR title=keyword) AND category=searchTerm
Any hints?
Create a method or computed attribute called "search_text" that returns the concatenation of abstract, content and title.
In ZPatterns I'd use the following SkinScript:
WITH SELF COMPUTE search_text='%s %s %s' % (abstract, content, title)
An equivalent PythonScript as a method of your ZClass would be:
name: search_text return '%s %s %s' % (container.abstract, container.content, container.title)
Use a similar method in a python class, replacing "container" with "self".
Set up search_text as a TextIndex in your ZCatalog.
Then, query the catalog with something like:
Catalog(search_text=keyword_for_query, category=searchTerm)
The standard name for the search_text method or attribute is PrincipiaSearchSource. That's why PrincipiaSearchSource is a default TextIndex in a new ZCatalog.
-- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
Steve, thanks for your hints. At moment I'm working with version 2.2.3 and could't bring it to work. Should it work? So I switched now tho 2.3 and after some struggles it works. Actually I have ZClass objects. Best regards Arno Gross, arno.gross@consotec.de On Thu, 08 Feb 2001, Steve Alexander wrote:
Arno Gross wrote:
Hi Steve, maybe I'm missing one step. If I create a TextIndex for search_text (or PrincipiaSearchSource) I have to tell somewhere how this index is composite? Becaus I try to list PrincipiaSearchSource in my result list it's empty.
You need to provide a method or property or attribute that gives the catalog the concatenated search text.
You haven't said what kind of objects you are cataloging: are they ZClass instances, Python class instances, DTML Documents... ?
You may be able to use a PythonScript in the acquisition path of your objects to do this work.
Arno Gross wrote:
Steve, thanks for your hints. At moment I'm working with version 2.2.3 and could't bring it to work. Should it work?
PythonScripts won't work. You should be able to do it with an External Method. I don't know about PythonMethods.
So I switched now tho 2.3 and after some struggles it works.
Great!
Actually I have ZClass objects.
-- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
participants (4)
-
Andy Dawkins -
Arno Gross -
Martijn Pieters -
Steve Alexander