Best Practices for Fields and Facets in NetSuite Commerce
Optimize performance in NetSuite Commerce by using fields and facets efficiently, limiting unnecessary data and enhancing user experience.
TL;DR
This article discusses best practices for managing fields and facets in the NetSuite Item Search API. Optimizing the usage of these elements can significantly improve site performance and deliver a better shopping experience.
Fields and Field Sets
When utilizing the Item Search API, it's crucial to specify relevant fields or field sets. If no fields are specified, the API defaults to returning only the internal IDs of items. For example, when displaying items on a list, fewer fields are preferable compared to a comprehensive view on a Product Detail page. While you can specify individual fields for each request, creating predefined field sets ensures consistency across your application.
Performance Costs of Individual Fields
Be aware that each additional field you request incurs performance costs. Some fields, like Name or Description, are inexpensive to generate, as they are static. Conversely, dynamic fields, such as those representing live stock information, are costlier. Regularly auditing your field sets to include only necessary fields is recommended.
Example Usage of quantityavailable: This field indicates the stock available for a specific item and is essential for Product List and Detail pages. Though it holds significant data, requesting this on existing orders is unnecessary and may degrade performance.
Expensive Fields
| Field | Usage | Field Sets to Avoid | Reason to Avoid |
|---|---|---|---|
| correlateditems_detail | Generates a list of related item details | details, order, search, typeahead | Works better for single items, not lists of multiple products. |
| matrixchilditems_detail | Retrieves child items of a specified product | order, search, typeahead | Not needed for product lists; can slow down performance. |
| itemoptions_detail | Lists all item options and their values | search | May compromise speed if included in wider field sets. |
| quantityavailable | Shows live stock status | order | Not relevant for past orders. |
| quantityavailable_detail | Provides breakdown of stock quantities | order, search, typeahead | Resource-intensive; use Boolean isinstock when possible. |
Facets
Facets should also be utilized judiciously. Here are some essential questions to consider:
- Is the filter genuinely useful for shoppers?
- How many values will this facet return?
- What are the item counts per facet value?
An abundance of unique facet options can confuse users and lead to poor performance.
Best Practices
- Limit total fields across Field Sets, Facet Fields, and Sort Fields to 1200 to prevent search index rebuild failures.
- Aim to keep facets to a maximum of 40; exceeding this may result in performance degradation.
- Ensure facet values remain under 1000.
- Each facet name should be clear and concise, ideally under 200 characters.
- Add facets only when absolutely necessary.
Remember:
- Omitting
include=facetsin your API request can enhance performance by preventing unnecessary facet generation. - Use
facet.excludeto intentionally skip unneeded facets from the results.
Preventing Facets from Rendering in Search Results
To prevent certain facets from appearing in search results, utilize the facets_facet_browse.tpl template to exclude them. Insert the facets to be excluded in the data-exclude-facets attribute:
<div data-view="Facets.FacetedNavigation" data-exclude-facets="commercecategoryname,category,myfacet,myotherfacet"><div>For users of SuiteCommerce or SuiteCommerce Advanced (2021.2 or later), you can implement the defineSearchMasterOptions() method on the Environment component to manage site-wide defaults for the Item Search API, including facets.
Key Takeaways
- Optimize field usage to enhance API performance and maintain a smooth user experience.
- Regularly audit field sets and facets to avoid unnecessary data generation.
- Maintain a balance between functionality and performance by limiting the number of fields, facets, and facet values.
Frequently Asked Questions (4)
What is the maximum number of facets recommended for optimal SuiteCommerce performance?
How can I prevent specific facets from appearing in search results?
Is there a field limit I should be aware of when configuring facets?
How can you optimize API requests involving facets for better performance?
Was this article helpful?
More in Commerce
- Loop Returns Integration in NetSuite Connector 2026.1
Loop Returns integration enhances NetSuite Connector by automating returns, refunds, and exchanges in version 2026.1.
- Available Items Only Feature in NetSuite 2026.1
Available items only filtering boosts sales efficiency in NetSuite 2026.1 with Intelligent Item Recommendations.
- Commerce Extensions in NetSuite 2026.1
Commerce Extensions in NetSuite 2026.1 enhance performance and user experience in eCommerce.
- Convert Multiple Transaction Line Items into Configured Items in
Enhance transaction processing in NetSuite by converting multiple line items into configured items with improved session handling.
