[ic] Search by category not working in localized foundation catalog

Thomas Weiss pater.noster at gmx.net
Mon Dec 8 05:59:04 EST 2003


When using the foundation catalog of IC 4.9.9 I stumbled across the
following problem:

When searching by category (i.e. using the category menu) no results are
shown when using a non-default locale. Reason is the following:

The category menu uses the selector field of the products table. Since
this field is not localized the generated one-click searches contain the
english category names
(/scan/st=db/co=yes/sf=category/se=Putty%20Knives/op=eq).  When
executing the search Vend::Table::Shadow is used to query the database
(select * from products  WHERE inactive != 1 AND category = 'Putty
Knives') since a database mapping has been configured for table
products. each_nokey() of Vend::Table::Shadow returns the mapped result,
so that the result contains the non-english category name. This result
is then passed to the limiting function (returned by
Vend::Search::get_limit()) which checks if the category name returned by
the query matches the search spec submitted with the search ("Putty
Knives" in this case). But since the returned result contains
non-english category names it doesn't match the search term and
therefore the result is discarded.

To work around the problem I tried to localize the selector field, which
correctly generates searches with localized category names, but it still
fails since the field name given in the selector field is assumed to be
a field of table products and the database mapping isn't applied since
the field name is used in the where clause of the database query
(select * from products  WHERE inactive != 1 AND category = 'Spachtel').
The result is the english category field being searched for a non-english
category name. To fix this Vend::Table::Shadow::each_nokey() would not
only have to apply the database mapping to the result of a query, but
also to the query itself.

To really work around the problem I had to put a localized category
field and a localized selector field (containing something like
"category_de_DE=Spachtel") into the products table and additionally a
localized selector field into the cat table or rather the shadow table
thereof.

There must be a better way to fix this. Any ideas?

Thomas


More information about the interchange-users mailing list