3 Replies Latest reply on Sep 16, 2008 5:54 AM by ilya_shaikovsky

    suggestionBox  text search

      Suggestion box setup, seems to be made with Sql searches in mind
      (after n chararacters pass the string each time to te sever,) wich includes a lot of overhead)

      Ive a text search module finding my proposed selection (hibernate search) but requery for every added character seems a lot of overkill


      I would like to query only as soon as non alfabetic characters nor digits
      are presented
      Some minor processing to be done on the client side to detect the characters.

      I'm not sure however how to integrate this JS with the suggestionBox
      can someone help me on the way .

        • 1. Re: suggestionBox  text search
          ilya_shaikovsky

          1) you could check the String right in autocomplete method and avoid to query the db according to some your conditions.

          2) If you want to work on client side - define your conditions in onsubmit attribute and return false if no request should be sent.

          • 2. Re: suggestionBox  text search

            As I work on server side,
            1)A packet will be ransmitted on every character entered
            This is exactly what I want to avoid

            2) onsubmit
            would not be triggered inter request ????


            I would like something like :



            
             <script>
             var token="?%*";
             function onSearchKeyUp()
             { var inpField=event.getSource();
             var len=inputField.length-1;
             if (token.indexOf(inpField.charAt(len))>-1)
             infField=inpField.substring(0,len);
             Call SuggestionBox(inpField);
             event.setSource(inputField);
             return false;
             }
             </script>
            


            This would cause the server to be called only when assistance is required



            Onsubmit will not do this

            • 3. Re: suggestionBox  text search
              ilya_shaikovsky

              2)

              onsubmit="if !confirm('call suggestion?'){return false;}"
              

              will cause cancel request.