[Zope] ZCatalog, FieldIndex, reindex problem (long)

Deb Richardson deb@hub.org
Sun, 28 May 2000 14:01:59 -0400


Hi all.

I've been playing with creating custom Catalog Aware ZClasses for the
last couple of days (following the various HowTos and tutorials), and
I've run into a problem which has me stumped.  I've been through all the
documentation I could find, plus as many of the list archives I could
deal with.  Here's the situation:

I created a new Product called "Library_Catalog".

In that Product, I created a custom ZClass "LibCatClass" that is
CatalogAware.

I created a ZCatalog "library_catalog" and changed the Indexes and
MetaData Table to include the following Class properties:

   Indexes (this is the complete list of custom class properties) 
	book_comments		(TextIndex)
	book_edition		"	
	book_isbn		"
	book_catalog_date	"
	book_publication_year	"
	book_sub_genre		"
	book_author		"
	book_genre		"
	book_publisher		"
	book_title		"
	book_description	"

   MetaData Table
	book_sub_genre
	book_publication_year
	book_author
	book_isbn
	book_genre
	book_publisher
	book_title 

I also created a ZSearch Interface with "library_search" and
"library_report" as the search/report DTML methods.

I then modified the "LibCatClass_add" constructor to include the
following:

<!--#with "LibCatClass.createInObjectManager(REQUEST['id'], REQUEST)"-->
   <!--#call
"propertysheets.LibCatItemInfo.manage_editProperties(REQUEST)"-->
   <!--#call "manage_editCataloger('library_catalog', REQUEST)"-->
   <!--#call index_object-->
<!--#/with-->

In the LibCatClass methods, I added "index_html", "edit_propertiesForm",
and "edit_properties".

The edit_properties method contains the following:

<dtml-var standard_html_header>
<!--#call
"propertysheets.LibCatItemInfo.manage_editProperties(REQUEST)"-->
<!--#call reindex_object-->
<p>Changes saved.</p>
<dtml-var standard_html_footer>

(I'm not including the source of edit_propertiesForm because I'm fairly
certain that it's irrelevant...if not, let me know and I'll provide it.)

Up to this point everything works fine...I can add new instances and
they're cataloged, I can edit the properties of those instances and the
changes are automatically cataloged.  All appears to be well.

Having cleared the catalog and deleted all the instances, I made a few
changes to the Indexes part of the catalog, which is when the problems
started.

I decided that I wanted to have a couple of "FieldIndex" type Indexes,
so I deleted the book_genre index and recreated it with "FieldIndex" as
its type.  I can add new instances and they're cataloged okay, and I can
edit the properties that are "TextIndex" types in the Indexes and
everything is still okay.  

But, when I try to edit the book_genre property (that is the
"FieldIndex" type) the instance no longer shows up when the catalog is
searched.  It's _in_ the catalog, but I get the "There was no data
matching this library query" message when I search for it.

So, I've been through the whole thing a dozen or so times, attempting to
track down the bug.  As far as I can tell, there is an issue related to
reindexing an instance that includes a "FieldIndex" index type.

Have I missed something obvious?  Anyone have any idea how I can fix
this?  

TIA

- deb (yes, I'm basically a Zope newbie, but I'm sure having a lot of
fun)