Hello all
I have a search form which has a computed field resolving to a search formula. I then use this formula in a script to do a db.search. It worked fine when there were only a few documents, but the dtabase has grown and the search is slooooooow.
The db is full text indexed and I have read that a db.ftsearch could be much faster. Can anyone tell me if there is a quick way to convert my formula to work wih ftsearch or do I have to rewrite?
formula
op := @If(searchoption=“Any”;“|”;“&”);
Suffix := @If(mailshottype=“P”; “&( paddress!=""&ptitle!=""&psurname!="")”;mailshottype=“S”;“”;“&( pemail!="")”);
md := @If(mailshottype!=“S”;“& (!pmaildisable="1")”;“”);
fuz := @If(ftoption=“F”;“@begins”;“@matches”);
n:=@If(psurname=“”;“”;@Implode(fuz+“(@LowerCase(psurname);"”+@LowerCase(psurname)+“"”+“) | “+fuz+”(@LowerCase(psurname_1);"”+@LowerCase(psurname)+“"”+“) |”));
n:= @If(n=“”;“”;@Ends(n;“|”);“(”+@LeftBack(n;“|”)+“)”+op;“(”+n+“)”+op);
cs := @If(currentstatus=“”;“”;“pcurrentstatus=”+currentstatus);
m := @If(pmoverequired=“”;“”;“Pmoverequired >=@Today & pmoverequired<=@TextToTime("”+@Text(pmoverequired)+“")”+op);
S:= @If(pstatus=“”;“”;@Implode(“@Contains(pstatus;"”+pstatus+“"”+“) |”));
S := @If(S=“”;“”;@Ends(s;“|”);“(”+@LeftBack(s;“|”)+“)”+op;“(”+s+“)”+op);
mp :=@If(pminprice=“”;“”;“pmaxprice >=”+@Text(pminprice/1.05)+op);
P := @If(pmaxprice=“”;“”;“pmaxprice <=”+@Text(pmaxprice*1.05)+op);
V := @If(ppropvalue=“”;“”;“ppropvalue”+Propvaloperator+“=”+@Text(ppropvalue*1.05)+op);
T := @If(ptypeinterest=“”;“”;@Implode(“@Contains(ptypeinterest;"”+ptypeinterest+“"”+“) |”));
T := @If(t=“”;“”;@Ends(t;“|”);“(”+@LeftBack(t;“|”)+“)”+op;“(”+t+“)”+op);
D := @If(psiteinterest=“”;“”;@Implode(“@Contains(psiteinterest;"”+psiteinterest+“"”+“) |”));
D := @If(d=“”;“”;@Ends(d;“|”);“(”+@LeftBack(d;“|”)+“)”+op;“(”+d+“)”+op);
PL:= @If(pplotinterest=“”;“”;@Implode(“@Contains(pplotinterest;"”+pplotinterest+“"”+“) |”));
pl := @If(pl=“”;“”;@Ends(pl;“|”);“(”+@LeftBack(pl;“|”)+“)”+op;“(”+pl+“)”+op);
Px:= @If(ppxinterest=“”;“”;@Implode(“@Contains(ppxinterest;"”+ppxinterest+“"”+“) |”));
px := @If(px=“”;“”;@Ends(px;“|”);“(”+@LeftBack(px;“|”)+“)”+op;“(”+px+“)”+op);
A:= @If(pareas=“”;“”;@Implode(“@Contains(pareas;"”+pareas+“"”+“) |”));
A:= @If(A=“”;“”;@Ends(A;“|”);“(”+@LeftBack(A;“|”)+“)”+op;“(”+A+“)”+op);
srch := mp+m+n+n2+cs+S+P+V+T+d+pl+px+A;
@If(srch=“”;“”;@Do(
@If(@Ends(srch;op);@LeftBack(srch;op);srch)+suffix+md))
thanks