Subject FTS: ibo42.r BUG?
Author John Tomaselli
Jason,
In taking a closer look at the problem I believe that error is caused by
some improper logic built into the triggers. The example below taken after
FATS created the trigger illustrates the problem. The audit's is a way for
me to test the trigger to see what's happening. At any rate the line below
should have OR and not AND. This explains why new or modified data is not
getting Indexed. I also modified the other 2 conditions in the trigger. Now
FATS shows all data in my searches and the 'Sync Events log' displays the
changes live. See New trigger for other 2 conditions for the other fixes.
Please advise,
John

Bad:
IF ((( OLD.DIRECTIONS IS NULL ) OR
( OLD.DIRECTIONS = '' )) AND
(( NEW.DIRECTIONS IS NOT NULL ) AND
( NEW.DIRECTIONS <> '' ))) THEN
Good:
IF ((( OLD.DIRECTIONS IS NULL ) OR
( OLD.DIRECTIONS = '' )) AND
(( NEW.DIRECTIONS IS NOT NULL ) OR
( NEW.DIRECTIONS <> '' ))) THEN




ALTER TRIGGER FTS$DIRECTIONS$AU_TBL
ACTIVE AFTER UPDATE POSITION 10
AS
BEGIN
INSERT INTO AUDIT_SP (AUDIT_ID,A_DESC,KEY1,KEY2, TIMEDATE,V1,V2,V3)
VALUES (2,'fts', NEW.ORG_ID, 2,
now',OLD.DIRECTIONS,NEW.DIRECTIONS,'' );
/*
IF ((( OLD.DIRECTIONS IS NULL ) OR
( OLD.DIRECTIONS = '' )) AND
(( NEW.DIRECTIONS IS NOT NULL ) AND
( NEW.DIRECTIONS <> '' ))) THEN begin
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'I' );
INSERT INTO AUDIT_SP (AUDIT_ID,A_DESC,KEY1,KEY2, TIMEDATE)
VALUES (2,'fts A', NEW.ORG_ID, 2, 'now' );
*/
IF ((( OLD.DIRECTIONS IS NULL ) OR
( OLD.DIRECTIONS = '' )) AND
(( NEW.DIRECTIONS IS NOT NULL ) or
( NEW.DIRECTIONS <> '' ))) THEN begin
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'I' );
INSERT INTO AUDIT_SP (AUDIT_ID,A_DESC,KEY1,KEY2, TIMEDATE)
VALUES (2,'fts A', NEW.ORG_ID, 2, 'now' );



end ELSE
IF ((( OLD.DIRECTIONS IS NOT NULL ) AND
( OLD.DIRECTIONS <> '' )) AND
(( NEW.DIRECTIONS IS NULL ) OR
( NEW.DIRECTIONS = '' ))) THEN begin
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'D' );
INSERT INTO AUDIT_SP (AUDIT_ID,A_DESC,KEY1,KEY2, TIMEDATE)
VALUES (2,'fts B', NEW.ORG_ID, 2, 'now' );

end ELSE
IF (( NEW.DIRECTIONS IS NOT NULL ) AND
( OLD.DIRECTIONS IS NOT NULL ) AND
( NEW.DIRECTIONS <> '' ) AND
( OLD.DIRECTIONS <> '' ) AND
( OLD.DIRECTIONS <>
NEW.DIRECTIONS )) THEN begin
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'U' );
INSERT INTO AUDIT_SP (AUDIT_ID,A_DESC,KEY1,KEY2, TIMEDATE)
VALUES (2,'fts c', NEW.ORG_ID, 2, 'now' );
end
END

New trigger for other 2 conditions:
IF ((( OLD.DIRECTIONS IS NOT NULL ) or
( OLD.DIRECTIONS <> '' )) AND
(( NEW.DIRECTIONS IS NULL ) OR
( NEW.DIRECTIONS = '' ))) THEN
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'D' );
ELSE
IF (((NEW.DIRECTIONS IS NOT NULL ) AND
(OLD.DIRECTIONS IS NOT NULL )) or
(( NEW.DIRECTIONS <> '' ) AND
( OLD.DIRECTIONS <> '' )) AND
( OLD.DIRECTIONS <> NEW.DIRECTIONS )) THEN
INSERT INTO FTS$DIRECTIONS$Q ( FTS$ORG_ID, FTS$Q_TYP )
VALUES( NEW.ORG_ID, 'U' );
VALUES (2,'fts 3', NEW.ORG_ID, 2, 'now' );








-


Hi Jason,
Just getting around to testing your FTS components and I'm having a problem.
Having followed your example in the FTS help file I have indexed the
Directions field (BLOB SUB_TYPE 1 SEGMENT SIZE 80) in my org table. My
initial results were quite promising as all data searched extremely fast.
It's when I modify the Directions field that things seem to go south. The
help files indicates that I should see the changes on the 'Sync Events Log'
tab. I check the Listen for Events, open IB_SQL modify the field and wait
for a message. Nothing shows. I then Press a combo of Resync Index or Clean
and Resync Index and then conduct a search of the data added since the
Creation of the FTS index. Sometimes the data shows, but mostly it doesn't.
If I drop metadata and rebuild the index from scratch everything shows. Any
idea's as to what I might be doing wrong?
TIA
John

-----Original Message-----
From: Jason Wharton [mailto:jwharton@...]
Sent: Friday, November 16, 2001 3:42 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Lobbyist sample app


I put the Lobbyist sample application and a database available for download
for registered users of IBO.

It is in a new folder called Extras. There are three zip files. One for the
source of the app, one for a zipped GBK of a live populated database (all
info is public record) and the source to a web application used for
searching the data (no FTS in this one). This should serve as a fairly good
representation of how I do applications. Not a lot of sizzle, but very easy
and simple to work with.

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com





___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/