Autocomplete in server side VS data transfer










-1














I need to implement auto-complete on the client side. The data is transmitted via the server.
This can be done in a number of ways. The two that I have thought of are:




  • Implement autocomplete on the server side:
    In this case I can think of efficiency problems. Is it effective to make a call to the server and back each keydown?


  • Data transfer: It is possible to transfer all the data from server to client on first need, but it seems unnecessary to a client that will not use autocomplete. Besides, would it not be heavy to pass all the data at once?

I use nodejs in server and angular cli in client.



I would be happy to hear your opinion, and I am also open to hearing additional options that I have not thought about and which can be effective in this case.










share|improve this question




























    -1














    I need to implement auto-complete on the client side. The data is transmitted via the server.
    This can be done in a number of ways. The two that I have thought of are:




    • Implement autocomplete on the server side:
      In this case I can think of efficiency problems. Is it effective to make a call to the server and back each keydown?


    • Data transfer: It is possible to transfer all the data from server to client on first need, but it seems unnecessary to a client that will not use autocomplete. Besides, would it not be heavy to pass all the data at once?

    I use nodejs in server and angular cli in client.



    I would be happy to hear your opinion, and I am also open to hearing additional options that I have not thought about and which can be effective in this case.










    share|improve this question


























      -1












      -1








      -1







      I need to implement auto-complete on the client side. The data is transmitted via the server.
      This can be done in a number of ways. The two that I have thought of are:




      • Implement autocomplete on the server side:
        In this case I can think of efficiency problems. Is it effective to make a call to the server and back each keydown?


      • Data transfer: It is possible to transfer all the data from server to client on first need, but it seems unnecessary to a client that will not use autocomplete. Besides, would it not be heavy to pass all the data at once?

      I use nodejs in server and angular cli in client.



      I would be happy to hear your opinion, and I am also open to hearing additional options that I have not thought about and which can be effective in this case.










      share|improve this question















      I need to implement auto-complete on the client side. The data is transmitted via the server.
      This can be done in a number of ways. The two that I have thought of are:




      • Implement autocomplete on the server side:
        In this case I can think of efficiency problems. Is it effective to make a call to the server and back each keydown?


      • Data transfer: It is possible to transfer all the data from server to client on first need, but it seems unnecessary to a client that will not use autocomplete. Besides, would it not be heavy to pass all the data at once?

      I use nodejs in server and angular cli in client.



      I would be happy to hear your opinion, and I am also open to hearing additional options that I have not thought about and which can be effective in this case.







      javascript node.js autocomplete client-server angular-cli






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 9:39









      ACupOfBreadTea

      215




      215










      asked Nov 12 at 9:26









      Hodaya Shalom

      1,89694593




      1,89694593






















          1 Answer
          1






          active

          oldest

          votes


















          1














          1.) Implementing auto complete on server side will definitely have some efficiency problems especially if you are talking to the backend on every keydown event. But this could be improved by setting up some ground rules like

          a.) Only call the api if user enters more than 2 words. Same should go if user types more than 20 words you should not look up for the data.

          b.) If you know what king of data persists for example only numeric (Do not allow user to enter any alphabets)

          c.) Always limit the data while fetching it from the Datasource to ensure limited number are records are being fetched to display.



          2.) Data transfers would also work only if in case you have limited amount of data lets say a few thousand records.

          a.) Do not try to fetch all data if you already know that the data is going to be huge. Keeping the point that you mentioned that user may or may not use this feature it wouuld be an unnecessary API call.

          b) If the data is limited this approach would be better than 1st approach as once for all you are going to store data at client side and no more unnecessary server calls.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259187%2fautocomplete-in-server-side-vs-data-transfer%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            1.) Implementing auto complete on server side will definitely have some efficiency problems especially if you are talking to the backend on every keydown event. But this could be improved by setting up some ground rules like

            a.) Only call the api if user enters more than 2 words. Same should go if user types more than 20 words you should not look up for the data.

            b.) If you know what king of data persists for example only numeric (Do not allow user to enter any alphabets)

            c.) Always limit the data while fetching it from the Datasource to ensure limited number are records are being fetched to display.



            2.) Data transfers would also work only if in case you have limited amount of data lets say a few thousand records.

            a.) Do not try to fetch all data if you already know that the data is going to be huge. Keeping the point that you mentioned that user may or may not use this feature it wouuld be an unnecessary API call.

            b) If the data is limited this approach would be better than 1st approach as once for all you are going to store data at client side and no more unnecessary server calls.






            share|improve this answer



























              1














              1.) Implementing auto complete on server side will definitely have some efficiency problems especially if you are talking to the backend on every keydown event. But this could be improved by setting up some ground rules like

              a.) Only call the api if user enters more than 2 words. Same should go if user types more than 20 words you should not look up for the data.

              b.) If you know what king of data persists for example only numeric (Do not allow user to enter any alphabets)

              c.) Always limit the data while fetching it from the Datasource to ensure limited number are records are being fetched to display.



              2.) Data transfers would also work only if in case you have limited amount of data lets say a few thousand records.

              a.) Do not try to fetch all data if you already know that the data is going to be huge. Keeping the point that you mentioned that user may or may not use this feature it wouuld be an unnecessary API call.

              b) If the data is limited this approach would be better than 1st approach as once for all you are going to store data at client side and no more unnecessary server calls.






              share|improve this answer

























                1












                1








                1






                1.) Implementing auto complete on server side will definitely have some efficiency problems especially if you are talking to the backend on every keydown event. But this could be improved by setting up some ground rules like

                a.) Only call the api if user enters more than 2 words. Same should go if user types more than 20 words you should not look up for the data.

                b.) If you know what king of data persists for example only numeric (Do not allow user to enter any alphabets)

                c.) Always limit the data while fetching it from the Datasource to ensure limited number are records are being fetched to display.



                2.) Data transfers would also work only if in case you have limited amount of data lets say a few thousand records.

                a.) Do not try to fetch all data if you already know that the data is going to be huge. Keeping the point that you mentioned that user may or may not use this feature it wouuld be an unnecessary API call.

                b) If the data is limited this approach would be better than 1st approach as once for all you are going to store data at client side and no more unnecessary server calls.






                share|improve this answer














                1.) Implementing auto complete on server side will definitely have some efficiency problems especially if you are talking to the backend on every keydown event. But this could be improved by setting up some ground rules like

                a.) Only call the api if user enters more than 2 words. Same should go if user types more than 20 words you should not look up for the data.

                b.) If you know what king of data persists for example only numeric (Do not allow user to enter any alphabets)

                c.) Always limit the data while fetching it from the Datasource to ensure limited number are records are being fetched to display.



                2.) Data transfers would also work only if in case you have limited amount of data lets say a few thousand records.

                a.) Do not try to fetch all data if you already know that the data is going to be huge. Keeping the point that you mentioned that user may or may not use this feature it wouuld be an unnecessary API call.

                b) If the data is limited this approach would be better than 1st approach as once for all you are going to store data at client side and no more unnecessary server calls.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 12 at 9:58

























                answered Nov 12 at 9:52









                kashish verma

                664




                664



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259187%2fautocomplete-in-server-side-vs-data-transfer%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    ReactJS Fetched API data displays live - need Data displayed static

                    Evgeni Malkin