Source: site.view [edit]
Function name: rewriteQuery
Arguments: q,dev
Description:
Page type: webl
Render function:  
Module: mapp

Page source:

      var w = [. "ipad" = [" for ipad ", " hd ", " ipad "],
            "ipod" = [" for ipod", " ipod "],
            "mac" = [" for mac", " mac "],
            "iphone" = [" for iphone", " iphone "] ,
            "-" = [" free ", " cheap ", " app ", " apps ", " fun ", " cool ", " great ", " good ", " top ", " new ", " rad ", " application ", " applications " ]
            .];

     var q2 = " " + Str_ToLowerCase(q) + " ";
     var res = [];
     every d in w do
         every srch in w[d] do
            res = res + [ srch ];
            var p = Str_IndexOf(srch, q2);
            if (p >= 0) then
               q2 = Select(q2, 0, p) + Select(q2, p+Size(srch) - 1, Size(q2) );
               if (d != "-") then
                  dev = d 
               end
            end;
         end;
     end;

      [. q = Str_Trim(q2), origq = q, device=dev .];