Hi all, I have a zcatalog. I use the methods generated by Z Search Interface to search the catalog. These methods will not recognize new additions to the catalog. After adding a coupon instance, the catalog search fails to find the new coupon or even the the old coupons. The add method of the zclass does have the statement: <dtml-call reindex_object>. The ZClass is subclassed catalogaware. There is a bug in Zope documented in the mailing lists. I found and tried the following code for my zclass add method: <HTML> <HEAD><TITLE>Add Coupon ZClass</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555"> <dtml-if DestinationURL> <dtml-call "RESPONSE.redirect( DestinationURL+'/manage_workspace')"> <dtml-else> <dtml-call "RESPONSE.redirect( URL2+'/manage_workspace')"> <dtml-with "CouponProductZClass.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.Basic.manage_changeProperties( REQUEST)"> <dtml-call reindex_object> </dtml-with> </dtml-if> </body></html> When I try to and an instance I get this error: Error Type: AttributeError Error Value: _u I am not sure how to restructure the method. I've been working on this for a while and I am stuck. Peacefully, Aaron
Aaron Payne:
Hi all,
Hi Aaron.
I have a zcatalog. I use the methods generated by Z Search Interface to search the catalog. These methods will not recognize new additions to the catalog. After adding a coupon instance, the catalog search fails to find the new coupon or even the the old coupons.
The add method of the zclass does have the statement: <dtml-call reindex_object>. The ZClass is subclassed catalogaware.
There is a bug in Zope documented in the mailing lists. I found and tried the following code for my zclass add method:
You have the dtml-if statement in the wrong place if you want the object to be created and then redirect. First, try it without the dtml-if statement like so.
<HTML> <HEAD><TITLE>Add Coupon ZClass</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<dtml-with "CouponProductZClass.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.Basic.manage_changeProperties( REQUEST)"> <dtml-call reindex_object> </dtml-with> </body></html>
Does it index it? Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Jason, At 11:41 pm 6/8/00 +0000, Jason Spisak wrote:
You have the dtml-if statement in the wrong place if you want the object to be created and then redirect. First, try it without the dtml-if statement like so.
<HTML> <HEAD><TITLE>Add Coupon ZClass</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<dtml-with "CouponProductZClass.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.Basic.manage_changeProperties( REQUEST)"> <dtml-call reindex_object> </dtml-with> </body></html>
I tried this in the add method. Actually, both the old and the new method reindexed the instance. The problem occurs when I try to search the catalog after adding the zclass. After adding an instance, the catalog search fails to find the new coupon or even the the old coupons. Only when I manually update the catalog in the mangament interface will it return any matches.
Does it index it?
Jason Spisak
Thanks, Aaron
Aaron Payne:
Jason,
At 11:41 pm 6/8/00 +0000, Jason Spisak wrote:
You have the dtml-if statement in the wrong place if you want the object to be created and then redirect. First, try it without the dtml-if statement like so.
<HTML> <HEAD><TITLE>Add Coupon ZClass</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<dtml-with "CouponProductZClass.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.Basic.manage_changeProperties( REQUEST)"> <dtml-call reindex_object> </dtml-with> </body></html>
I tried this in the add method. Actually, both the old and the new method reindexed the instance. The problem occurs when I try to search the catalog after adding the zclass. After adding an instance, the catalog search fails to find the new coupon or even the the old coupons. Only when I manually update the catalog in the mangament interface will it return any matches.
I helped another person through almost the exact same situation you are describing. Check the mailing list archives in February. I think has to do with the report/search pages. Although, the catalog shouldn't return different results if you type in /reindex_object after the URL of a CatalogAware object, or if you use the update Catalog facility. Try appending /reindex_object to the URL of the new instance after you create it. Just out of curiousity, what is making you think it's indexing it? All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Jason, I believe the ZCatalog is indexing the new instances because I can see them in the catalog in the management interface. -Aaron At 03:42 pm 6/9/00 +0000, Jason Spisak wrote:
Just out of curiousity, what is making you think it's indexing it?
All my best,
Jason Spisak
Aaron Payne writes:
Jason, I believe the ZCatalog is indexing the new instances because I can see them in the catalog in the management interface. -Aaron
Then it has to be the search forms. Can you sned me the search and report methods. Also, you should try looking up and instance programatically right after you create it, like so: <dtml-in "Catalog(myProperty='knownValue')"> <dtml-var id> </dtml-in> Where myProerty is the property you are searching for, and 'knownValue' si something you put in when you created your instance. And see if it brings you back your instance. If it does, then it's the forms. If not then you are calling reindex before those values are set.
At 03:42 pm 6/9/00 +0000, Jason Spisak wrote:
Just out of curiousity, what is making you think it's indexing it?
All my best,
Jason Spisak
Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
At 07:37 pm 6/9/00 +0000, Jason Spisak wrote: Then it has to be the search forms. Can you sned me the search and report methods. Also, you should try looking up and instance programatically right after you create it, like so: <dtml-in "Catalog(myProperty='knownValue')"> <dtml-var id> </dtml-in> Jason, I used the dtml-in for the catalog(myproperyty='xyz') and I found the newly added zclass. It may be the z search forms. Thanks for your help, Aaron Here is the search method: <dtml-var standard_html_header> <strong>Coupon Search Results....</strong> <P> <dtml-if vendor><strong>Vendor:</strong> <dtml-var vendor><BR></dtml-if> <dtml-if categorylist><strong>Subcategory:</strong> <dtml-var categorylist><BR></dtml-if> <dtml-if coupon_text><strong>Coupon Text:</strong> <dtml-var coupon_text><BR></dtml-if> <dtml-if zip><strong>Zip:</strong> <dtml-var zip><BR></dtml-if> <P> <dtml-in Catalog size=50 start=query_start> <dtml-if sequence-start> <dtml-if previous-sequence> <a href="<dtml-var URL><dtml-var sequence-query >query_start=<dtml-var previous-sequence-start-number>"> (Previous <dtml-var previous-sequence-size> results) </a> </dtml-if previous-sequence> <table border> <tr> <th>Vendor</th> <th>Coupon text</th> <th>Homepage</th> </tr> </dtml-if sequence-start> <tr> <td><a href="<!--#var "Catalog.getpath(data_record_id_)"-->"><dtml-var vendor></a></td> <td><dtml-var coupon_text></td> <td><a href="http://<dtml-var homepage>"><dtml-var homepage></a></td> </tr> <dtml-if sequence-end> </table> <dtml-if next-sequence> <a href="<dtml-var URL><dtml-var sequence-query >query_start=<dtml-var next-sequence-start-number>"> (Next <dtml-var next-sequence-size> results) </a> </dtml-if next-sequence> </dtml-if sequence-end> <dtml-else> There was no data matching this <dtml-var title_or_id> query. </dtml-in> <dtml-var menu> <dtml-var standard_html_footer> Here is the report method: <dtml-var standard_html_header> <form action="CatReport" method="get"> <h2><dtml-var document_title></h2> Enter query parameters:<br><table> <tr><th>Coupon text</th> <td><input name="coupon_text" width=30 value=""></td></tr> <tr><th>Categorylist</th> <td><input name="categorylist" width=30 value=""></td></tr> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr> <tr><th>Zip</th> <td><input name="zip" width=30 value=""></td></tr> <tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form> <dtml-var menu> <dtml-var standard_html_footer>
I'm in a similar situation with Aaron, except my product is mostly python. I emulated the cataloging in the PortalCatalog method, but left out the permission check. When my product is added to a folder, the catalog gets created, and has the indexes I set up. I can create a zsearchinterface, and search/find the instance of my product, but none of the data that exists below that. Do my sub-objects need to inherit from any zope classes in order to get indexed? I know the Zclasses do this automatically, what's the majick trick for this in python? I have tried, catalogAwareness, index_object at item creation, and reindex_object at item edit. none of these seem to do it, I imagine because the catalog wants them to be a certain type, and they're not. Any ideas?
Aaron Payne writes: We are closing in on it.
At 07:37 pm 6/9/00 +0000, Jason Spisak wrote: Then it has to be the search forms. Can you sned me the search and report methods. Also, you should try looking up and instance programatically right after you create it, like so:
<dtml-in "Catalog(myProperty='knownValue')"> <dtml-var id> </dtml-in>
Jason,
I used the dtml-in for the catalog(myproperyty='xyz') and I found the newly added zclass. It may be the z search forms.
Thanks for your help, Aaron
Yep. Let's take a look. <search snipped>
Here is the report method: <dtml-var standard_html_header>
Are any of these field indexes? Vendor maybe, Zip? If the ZClass instances always have a value for them, then when you submit this search and leave one of the 'field index' input boxes blank, you'll get no results, I believe.
<form action="CatReport" method="get"> <h2><dtml-var document_title></h2> Enter query parameters:<br><table>
<tr><th>Coupon text</th> <td><input name="coupon_text" width=30 value=""></td></tr> <tr><th>Categorylist</th> <td><input name="categorylist" width=30 value=""></td></tr> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr> <tr><th>Zip</th> <td><input name="zip" width=30 value=""></td></tr>
<tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form>
<dtml-var menu> <dtml-var standard_html_footer>
Try simplifying it. Try one at a time to find out which one is forcing the no results. All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
At 04:35 pm 6/12/00 +0000, Jason Spisak wrote:
We are closing in on it. Are any of these field indexes? Vendor maybe, Zip? If the ZClass instances always have a value for them, then when you submit this search and leave one of the 'field index' input boxes blank, you'll get no results, I believe.
vendor and zip are field indexes. coupon_text and categorylist are keyword indexes. If you add an instance and then try to search, no results will be found. Here's the odd thing. After I add an instance, I go to the zcatalog object in the management interface and manually hit the "update Catalog" button. If I run the search again the new instance will be found if it matches the search criteria. The search will work with one or more search criteria entered into the form fields.
<form action="CatReport" method="get"> <h2><dtml-var document_title></h2> Enter query parameters:<br><table>
<tr><th>Coupon text</th> <td><input name="coupon_text" width=30 value=""></td></tr> <tr><th>Categorylist</th> <td><input name="categorylist" width=30 value=""></td></tr> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr> <tr><th>Zip</th> <td><input name="zip" width=30 value=""></td></tr>
<tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form>
<dtml-var menu> <dtml-var standard_html_footer>
Try simplifying it. Try one at a time to find out which one is forcing the no results. Jason Spisak
Aaron Payne writes:
At 04:35 pm 6/12/00 +0000, Jason Spisak wrote:
We are closing in on it. Are any of these field indexes? Vendor maybe, Zip? If the ZClass instances always have a value for them, then when you submit this search and leave one of the 'field index' input boxes blank, you'll get no results, I believe.
vendor and zip are field indexes. coupon_text and categorylist are keyword indexes.
If you add an instance and then try to search, no results will be found. Here's the odd thing. After I add an instance, I go to the zcatalog object in the management interface and manually hit the "update Catalog" button. If I run the search again the new instance will be found if it matches the search criteria. The search will work with one or more search criteria entered into the form fields.
You were you able to find it programatically, right? If so, then it's the form. Try just searching using a form that searches the exact same proerty as the prgramatical search...example: <dtml-in "Catalog(vendor='MyVendor')"> <dtml-var id> </dtml-in> <form action="CatReport" method="get"> <h2><dtml-var document_title></h2> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr> <tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form> What happens?
<form action="CatReport" method="get"> <h2><dtml-var document_title></h2> Enter query parameters:<br><table>
<tr><th>Coupon text</th> <td><input name="coupon_text" width=30 value=""></td></tr> <tr><th>Categorylist</th> <td><input name="categorylist" width=30 value=""></td></tr> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr> <tr><th>Zip</th> <td><input name="zip" width=30 value=""></td></tr>
<tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form>
<dtml-var menu> <dtml-var standard_html_footer>
Try simplifying it. Try one at a time to find out which one is forcing the no results. Jason Spisak
Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
At 04:59 pm 6/13/00 +0000, Jason Spisak wrote:
Try just searching using a form that searches the exact same proerty as the prgramatical search...example: <dtml-in "Catalog(vendor='MyVendor')"> <dtml-var id> </dtml-in> This search finds vendor. cool.
<form action="CatReport" method="get"> <h2><dtml-var document_title></h2> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr>
<tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form>
The form above works. When I add a second field, the search fails. You can't search the catalog for more than one item at a time? Here is another note: When I update the catalog in the management interface the search will work with criteria from only one of the two fields. 1. add an instance to the catalog 2. enter one or more search criteria into form with more than two fields 3. search fails to find old or new objects in catalog 4. update the catalog in the management interface 5. enter one or more search criteria into form with more than two fields 3. search finds matches in catalog -Aaron
What happens? Jason Spisak
Aaron Payne writes:
At 04:59 pm 6/13/00 +0000, Jason Spisak wrote:
Try just searching using a form that searches the exact same proerty as the prgramatical search...example: <dtml-in "Catalog(vendor='MyVendor')"> <dtml-var id> </dtml-in> This search finds vendor. cool.
Chillin'
<form action="CatReport" method="get"> <h2><dtml-var document_title></h2> <tr><th>Vendor</th> <td><input name="vendor" width=30 value=""></td></tr>
<tr><td colspan=2 align=center> <input type="SUBMIT" name="SUBMIT" value="Submit Query"> </td></tr> </table> </form>
The form above works. When I add a second field, the search fails.
Hmm.
You can't search the catalog for more than one item at a time?
Yes. You can, actually. I do it everyday. I am stumped on this one.
Here is another note: When I update the catalog in the management interface the search will work with criteria from only one of the two fields.
1. add an instance to the catalog 2. enter one or more search criteria into form with more than two fields 3. search fails to find old or new objects in catalog 4. update the catalog in the management interface 5. enter one or more search criteria into form with more than two fields 3. search finds matches in catalog
I have had this happen on occassion. I have never really figured out what causes old instances to dissapear like that. I think it happened when I called reindex_object on something directly though. I would chuck this into the Collector. Or better yet, check out a CVS version or 2.2.0b1 download and try the same forms there. Just copy you Data.fs over and see if the Catalog acts the same. Michel P. may have fixed this already. Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (3)
-
Aaron Payne -
ed colmar -
Jason Spisak