-1

The database stores 50,000 records. Records have a title and id. I need to do a search by title with autocomplete.

Is jQuery UI + ajax suitable for this? Or are there faster ways to do this?

For ajax, will I need to do MyRecord.all in the index action? Then forward the ajax request to this action?

mrzasa
  • 22,895
  • 11
  • 56
  • 94
RomanOks
  • 692
  • 3
  • 13
  • 1
    jQueryUI and AJAX are half of the solution. I'd be more concerned with database performance, and ensuring you can quickly search by a given filter string on the server side, all while maintaining performance when there's N users concurrently making requests. – Rory McCrossan Sep 23 '19 at 13:35
  • 1
    Also, if it wasn't clear from the above, dumping 50,000 records to the client side via AJAX to search through is not a workable solution. You will need to filter on the server. – Rory McCrossan Sep 23 '19 at 13:37

1 Answers1

1

I would suggest to do the autocompletion on the server side. Loading 50k records from the DB to Rails, serializing it to JSON and parsing in JS will be quite slow.

Possible solutions for finding matches:

mrzasa
  • 22,895
  • 11
  • 56
  • 94