3 Tips to Speed Up a Search (SuiteCommerce & SuiteScript)

in , , August 6th, 2024

Both front-end (SuiteCommerce) and back-end (SuiteScripts) code often require searches. Here are three tips on speeding up your searches.

Tip 1: Only Get the Data You Need

Be sure not to add unnecessary columns to your search queries, and add all appropriate filters so that you get the exact results you require. Larger searches slow down your script, slow down network traffic, and are generally considered poor code.

Tip 2: Only Get the Data When You Need It

Make sure you are running searches only where and when you need the data. For example, nest searches inside conditionals when applicable to make sure they only run in the context you need them to. Also, in the front end, be sure to run searches right before they are needed and not any earlier. For example, if you are displaying a table of search results, do not make an HTTP request for the results until the view displaying them is about to render.

Tip 3: Use Pagination When You Can

Pagination can substantially reduce a search query's run time, especially for SuiteCommerce. If you ever expect to display (in an extension or Suitelet) more than 20 results at a time, it is highly recommended that you build pagination into your code.

Want to learn more about speeding up searches? Check out this full tutorial article on Speeding Up a Saved Search in NetSuite by Splitting It.

Author: Sam Gagliardi


Got stuck on a step in this article?

We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!

 
 

Want to keep learning?

Our team of NetSuite professionals has written articles on a wide variety of NetSuite topics, from SuiteCommerce tips, to recommended NetSuite solutions, to available support services, and more! 

Your cart