[Zope] ZCatalog Reindex_object Problems
Manuel Schulte
manuel@alpha.sea-to-sky.net
Tue, 18 Jul 2000 16:30:51 -0700 (PDT)
Hi,
I've been struggling trying to get the catalog to index catalog
aware objects. There are several messages from people with similar
problems, in the archives, but none of the solutions seem to work. I have
created a Product with a catalog aware class called Job_Request. The
Product also has a Job_Request_addForm method and a Job_Request_add
method. The form simply asks for user input for various fields and the
Job_Request_add method is meant to create the class instance, set the
properties, and index the object. In order to test the class I made an
object which lists all items the catalog as well as allows me to search on
a single field. The problem seems to be that the catalog will not update
after I Input a value that the catalog has not yet seen for a particular
field. Some Examples:
1. The catalog already has a Job_Request object with the
agency_name property set to NASA. If I add another object to the catalog
with agency_name = 'NASA', the result lists for an unrestricted search and
a search restricted to NASA both contain the correct record.
2. I delete all objects where agency_name ='NASA' and then I add
a new one with the same agency_name, I get the same results as above.
3. I add a new Job_Request where the value of agency_name is one
that has yet to have been cataloged i.e. agency_name =
'NeverHadThisValue', and the results for an unrestricted search on
agency_name shows the record, but the results restricted by agency_name =
'NeverHadThisValue' comes up empty.
Any help on this would be greatly appreciated (Is it a bug? If so
what's the best workaround)....
Manuel
What follows is the code for my Job_Request_add method and my SearchTest
method:
Job_Request_add:
<dtml-var standard_html_header>
<dtml-call "REQUEST.set('ts', ZopeTime())">
<dtml-call "REQUEST.set('id',_.str(_.int(ts)))">
<dtml-call "REQUEST.set('agency_name', agency_name)">
......many more REQUEST.set's .......
<dtml-with "Job_Request.createInObjectManager(REQUEST['id'], REQUEST)">
<dtml-call
"propertysheets.Job_Details.manage_editProperties(REQUEST)">
<dtml-call reindex_object>
</dtml-with>
<dtml-if NoRedir>
<dtml-else>
<dtml-if DestinationURL>
<dtml-call "RESPONSE.redirect(
DestinationURL+'/manage_workspace')">
<dtml-else>
<dtml-call "RESPONSE.redirect(
URL2+'/manage_workspace')">
</dtml-if>
</dtml-if>
<dtml-var standard_html_footer>
TestSearch:
<dtml-var standard_html_header>
<H2>Entire Catalog</H2>
<p>
<dtml-in "Catalog(agency_name='')">
<BR>
<dtml-var agency_name>
<dtml-var id>
</dtml-in>
<H2>Single Record</H2>
<p>
<dtml-in "Catalog(agency_name='NewName')">
<BR>
<dtml-var agency_name>
<dtml-var id>
</dtml-in>
<H2>Try a Search</H2>
<form action="available_positions_report" method="get">
<tr><th>Agency_name</th>
<td><input name="agency_name"
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 standard_html_footer>