logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • jerome vaure
    • Posted on Thu 1 Aug 2002

    I'll use this comment as a "code store". I know this post won't make sense to everyone, so if you think that it's useless, feel free to delete it Jake !

    Sometimes you have to deal with users that don't use english nor boolean logic often. (i do)

    So we may need to : - change their native language "AND" and "OR" into the english one (that domino understands) - automatically add "AND" (or "OR") between the words (if not it seems that domino will look for the whole sentence) - deal with the special characters that can be wrongly indexed

    so here are a few javascript functions :

    // translate the french boolean operators into english var pattern = new RegExp(/\bou\b/gi); str = str.replace(pattern,"OR"); pattern = new RegExp(/\bet\b/gi); str = str.replace(pattern,"AND");

    // automatically add "AND" between words (if there is no operator in the query) if ( (!str.match(/\bor\b/ig)) && (!str.match(/\band\b/ig)) ) { pattern=/\s+/ig; str = str.replace(pattern, " AND "); }

    //remove the accents, diaeresis... pattern = new RegExp("[éëèê]", "gi"); str = str.replace(pattern,"e"); pattern = new RegExp("[ïî]", "gi"); str = str.replace(pattern,"i"); pattern = new RegExp("[àäâ]", "gi"); str = str.replace(pattern,"a"); pattern = new RegExp("[üûù]", "gi"); str = str.replace(pattern,"u"); pattern = new RegExp("[öô]", "gi"); str = str.replace(pattern,"o");

    all of this can be added in the doSearch() function.

    hope this helps...

Your Comments

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