<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="sans-serif">Hi,<br>
<br>
I'm getting indexes updated on object creation but not when they
are modified, unless I call ICatalog.updateIndexes(). Shouldn't
the catalog be notified about modifications and update affected
indexes?<br>
<br>
This is more or less what I have:<br>
<br>
class Helpdesk(grok.Application, grok.Container):<br>
def __init__(self):<br>
super(Helpdesk, self).__init__()<br>
self["tickets"] = TicketCatalog()<br>
<br>
class TicketCatalog(grok.Container):<br>
pass<br>
<br>
class Ticket(grok.Model):<br>
def __init__(self, reporter):<br>
super(Ticket, self).__init__()<br>
self.reporter = reporter<br>
<br>
class TicketIndex(grok.Indexes):<br>
grok.site(Helpdesk)<br>
grok.context(Ticket)<br>
<br>
reporter = grok.index.Field()<br>
<br>
<br>
After adding an object I get it from searchResults:<br>
<br>
ticket1 = Ticket("foo")<br>
context["1"] = ticket1<br>
catalog = getUtility(ICatalog)<br>
results = catalog.searchResults( reporter=("bar", "bar") )<br>
(results empty)<br>
<br>
here "context" would be an instance of TicketCatalog. However, if
later I<br>
decide to modify the stored object, the index is not updated and
searchResults<br>
still gives me the same results:<br>
<br>
ticket1.reporter = "bar"<br>
catalog = getUtility(ICatalog)<br>
results = catalog.searchResults( reporter=("bar", "bar") )<br>
(results empty again)<br>
<br>
catalog.updateIndexes()<br>
</font><font face="sans-serif">results = catalog.searchResults(
reporter=("bar", "bar") )<br>
(I get the ticket)</font><br>
<br>
Is there anything wrong?<br>
<br>
Thanks,<br>
Àlex<br>
</body>
</html>