Hello. I have created my first auto-complete fields (text_field_with_auto_complete) and I find the feature a little slow. It takes about a second to see the values pop up on screen. I have tried to play with the :frequency option but I don''t see any appreciable difference with anything I do to increase the speed of the feature. Any ideas? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Check your database query speed (Check your development.log). If the database retrieval speed is less, it might bog down the auto-complete popup. Add appropriate indexes if that is the case. Cheers, Ganesh Gunasegaran. SageWork(http://www.sagework.com) Simplify IT On Fri, Jul 25, 2008 at 7:54 PM, pepe <Pepe-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote:> > Hello. > > I have created my first auto-complete fields > (text_field_with_auto_complete) and I find the feature a little slow. > It takes about a second to see the values pop up on screen. I have > tried to play with the :frequency option but I don''t see any > appreciable difference with anything I do to increase the speed of > the feature. > > Any ideas? > > Thanks > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will check into that. Thanks. Pepe On Jul 25, 10:04 am, "Ganesh Gunasegaran" <m...-GxHoNkCV/tgAvxtiuMwx3w@public.gmane.org> wrote:> Hi, > Check your database query speed (Check your development.log). If the > database retrieval speed is less, it might bog down the auto-complete popup. > Add appropriate indexes if that is the case. > > Cheers, > Ganesh Gunasegaran. > SageWork(http://www.sagework.com) Simplify IT > > On Fri, Jul 25, 2008 at 7:54 PM, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote: > > > Hello. > > > I have created my first auto-complete fields > > (text_field_with_auto_complete) and I find the feature a little slow. > > It takes about a second to see the values pop up on screen. I have > > tried to play with the :frequency option but I don''t see any > > appreciable difference with anything I do to increase the speed of > > the feature. > > > Any ideas? > > > Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
pepe wrote:> Will check into that. Thanks. > > PepeDo as little to respond to the auto-complete request. For example, if you use sessions, turn them off for that request. Pull the results from a cache if you can. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Certainly also avoid complex SQL queries like table joins and eager loading to get the content of the auto-complete field. And as mentioned be absolutely sure that any field used in the WHERE clause is indexed on the database table. On Jul 25, 12:07 pm, Jeremy Weiskotten <rails-mailing-l...@andreas- s.net> wrote:> pepe wrote: > > Will check into that. Thanks. > > > Pepe > > Do as little to respond to the auto-complete request. For example, if > you use sessions, turn them off for that request. Pull the results from > a cache if you can. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have actually tried pretty much everything I could with my limited knowledge of RoR. One thing I did was to store the results of the queries in arrays the first time they were loaded and then use the arrays instead of going to the table again. I have not noticed any difference in speed in that case. One reason might be that my test tables don''t have much data. Thank you for the insight. Pepe On Jul 25, 12:07 pm, Jeremy Weiskotten <rails-mailing-l...@andreas- s.net> wrote:> pepe wrote: > > Will check into that. Thanks. > > > Pepe > > Do as little to respond to the auto-complete request. For example, if > you use sessions, turn them off for that request. Pull the results from > a cache if you can. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The query is almost as simple as could be. There is an :order clause but there is an index on the field I sort by: def self.get_codes return MyModel.find( :all, :select => ''code'', :order => ''code'' ).collect {|row| row.code} end Thanks. Pepe On Jul 25, 12:26 pm, Robert Walker <r0b3rt4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Certainly also avoid complex SQL queries like table joins and eager > loading to get the content of the auto-complete field. And as > mentioned be absolutely sure that any field used in the WHERE clause > is indexed on the database table. > > On Jul 25, 12:07 pm, Jeremy Weiskotten <rails-mailing-l...@andreas- > > s.net> wrote: > > pepe wrote: > > > Will check into that. Thanks. > > > > Pepe > > > Do as little to respond to the auto-complete request. For example, if > > you use sessions, turn them off for that request. Pull the results from > > a cache if you can. > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
pepe wrote:> The query is almost as simple as could be. There is an :order clause > but there is an index on the field I sort by: > > def self.get_codes > return MyModel.find( > :all, > :select => ''code'', > :order => ''code'' > ).collect {|row| row.code} > end > > Thanks. > > PepeIs this a development environment? If so, in development mode, Rails does a bunch of work on every request, such as reloading all of the classes, which doesn''t happen in a production environment. Try starting your server in production mode (such as mongrel_rails start -e -production). You''ll need to edit database.yml to point the production config to your dev database, or set up a production db. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
At any case if you doing ajax request to server autocomplete WILL be slow. You need to look into AutoCompleter.Local if you have limited number of options (more than hundred will be overload). On Jul 25, 5:54 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote:> Hello. > > I have created my first auto-complete fields > (text_field_with_auto_complete) and I find the feature a little slow. > It takes about a second to see the values pop up on screen. I have > tried to play with the :frequency option but I don''t see any > appreciable difference with anything I do to increase the speed of > the feature. > > Any ideas? > > Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I new that I could use Javascript to hold the values and make the process faster by letting the browser itself handle the requests but I am not an expert in web development and I know the minimal Javascript to go by. One thing I don''t want to do is hard code the values in a Javascript array like this example shows: http://github.com/madrobby/scriptaculous/wikis/autocompleter-local Would it be possible to get some information as to how to load a Javascript array with the data from model when the action is first invoked? That would probably be the best way to go. Thanks! Pepe On Jul 26, 5:35 am, miv <michael.varamashv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> At any case if you doing ajax request to server autocomplete WILL be > slow. You need to look into AutoCompleter.Local if you have limited > number of options (more than hundred will be overload). > > On Jul 25, 5:54 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote: > > > Hello. > > > I have created my first auto-complete fields > > (text_field_with_auto_complete) and I find the feature a little slow. > > It takes about a second to see the values pop up on screen. I have > > tried to play with the :frequency option but I don''t see any > > appreciable difference with anything I do to increase the speed of > > the feature. > > > Any ideas? > > > Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Pepe, The example that you link to, http://github.com/madrobby/scriptaculous/wikis/autocompleter-local looks like what you want, except that you don''t want to hard code the array in javascript. I would suggest that you save the information that you fetch from your database in a javascript array and then use the local autocompleter from above. For example, let''s say that you want to autocomplete bands like in the local autocompleter example. You might have fetched all your band names in to the variable @band_names, with something like: @band_names = Band.all.collect {|b| b.name } And then in your view you can use this javascript to set the autocompleter array (I''m assuming you are using erb templates): var bandsList = [<%= @band_names * (", ") %>] Hope this helps. Regards, Philip Bruce On Jul 26, 9:14 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote:> I new that I could use Javascript to hold the values and make the > process faster by letting the browser itself handle the requests but I > am not an expert in web development and I know the minimal Javascript > to go by. One thing I don''t want to do is hard code the values in a > Javascript array like this example shows:http://github.com/madrobby/scriptaculous/wikis/autocompleter-local > > Would it be possible to get some information as to how to load a > Javascript array with the data from model when the action is first > invoked? That would probably be the best way to go. > > Thanks! > > Pepe > > On Jul 26, 5:35 am, miv <michael.varamashv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > At any case if you doing ajax request to server autocomplete WILL be > > slow. You need to look into AutoCompleter.Local if you have limited > > number of options (more than hundred will be overload). > > > On Jul 25, 5:54 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote: > > > > Hello. > > > > I have created my first auto-complete fields > > > (text_field_with_auto_complete) and I find the feature a little slow. > > > It takes about a second to see the values pop up on screen. I have > > > tried to play with the :frequency option but I don''t see any > > > appreciable difference with anything I do to increase the speed of > > > the feature. > > > > Any ideas? > > > > Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The speed (or lack of) I''m noticing is during my own testing. I just would like it to be instantaneous so when somebody types a letter the list comes up right away instead of waiting for about a second or so. My test tables contain very little information (4 or 5 records in most cases) but I still have to wait for that second or so. Thank you for the input, though. Pepe On Jul 28, 8:52 am, MW Administrator <michiganwaterfowl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You may already be doing this but a spinner can help overcome a second > or two of querying. Its a border-line putty/duct tape fix but works. > > Philip Bruce wrote: > > Hi Pepe, > > > The example that you link to, > > >http://github.com/madrobby/scriptaculous/wikis/autocompleter-local > > > looks like what you want, except that you don''t want to hard code the > > array in javascript. I would suggest that you save the information > > that you fetch from your database in a javascript array and then use > > the local autocompleter from above. > > > For example, let''s say that you want toautocompletebands like in the > > local autocompleter example. You might have fetched all your band > > names in to the variable @band_names, with something like: > > > @band_names = Band.all.collect {|b| b.name } > > > And then in your view you can use this javascript to set the > > autocompleter array (I''m assuming you are using erb templates): > > > var bandsList = [<%= @band_names * (", ") %>] > > > Hope this helps. > > > Regards, > > Philip Bruce > > > On Jul 26, 9:14 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote: > >> I new that I could use Javascript to hold the values and make the > >> process faster by letting the browser itself handle the requests but I > >> am not an expert in web development and I know the minimal Javascript > >> to go by. One thing I don''t want to do is hard code the values in a > >> Javascript array like this example shows:http://github.com/madrobby/scriptaculous/wikis/autocompleter-local > > >> Would it be possible to get some information as to how to load a > >> Javascript array with the data from model when the action is first > >> invoked? That would probably be the best way to go. > > >> Thanks! > > >> Pepe > > >> On Jul 26, 5:35 am, miv <michael.varamashv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> At any case if you doing ajax request to serverautocompleteWILL be > >>> slow. You need to look into AutoCompleter.Local if you have limited > >>> number of options (more than hundred will be overload). > >>> On Jul 25, 5:54 pm, pepe <P...-gUAqH5+0sKL6V6G2DxALlg@public.gmane.org> wrote: > >>>> Hello. > >>>> I have created my firstauto-completefields > >>>> (text_field_with_auto_complete) and I find the feature a little slow. > >>>> It takes about a second to see the values pop up on screen. I have > >>>> tried to play with the :frequency option but I don''t see any > >>>> appreciable difference with anything I do to increase thespeedof > >>>> the feature. > >>>> Any ideas? > >>>> Thanks--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---