logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • laurens
    • Posted on Mon 24 Jan 2005 03:40

    Two questions about the search:

    1. will you make the searchform submit on hitting enter?

    2. will you eliminate the necessity of putting "AND"-operators in between the search terms?

    {Link} This link uses javascript. If you would like to use @formula language, you could try the code below.

    REM {hyphen can be part of a word, or as NOT};

    trimmedquery:=@LowerCase(@Trim(text));

    t000:=@If(@Begins(trimmedquery;"-");" "+trimmedquery;trimmedquery);

    REM {hyphen can be part of a word, or as NOT};

    trimmedquery:=@LowerCase(@Trim(text));

    t000:=@If(@Begins(trimmedquery;"-");" "+trimmedquery;trimmedquery);

    REM {the hyphens that are not part of a word-combination are replaced by NOT and before and after quotation marks # (pound-keys) are placed};

    t00:=@ReplaceSubstring(t000;

    " - " :" -" : " not " : " \"" :"\" " ;

    "%20and%20not%20" : "%20and%20not%20" : "%20and%20not%20" : "#\"" :"\"#");

    t0:=@Explode(t00;"#");

    REM {the query is split into elements, where everything between quotation marks is a seperate element};

    xt:=@Transform(

    t0; "x";

    @If(

    @Contains(x;"\"");

    @ReplaceSubstring(@Trim(x);" ";"%20");

    @Trim(x)));

    REM {to avoid AND operator between words in between quotation marks, the spaces are filled with %20};

    xt1:=@Trim(@Implode(@Unique(xt);" "));

    @ReplaceSubstring(xt1; " & " :" or ": " contains " : " " : "\"" ;

    "%20%26%20" :"%20or%20": "%20contains%20" : "%20and%20" : "%22")

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: