Improve the Performance of the Search Results Page
You can improve the performance of search result pages in Commerce web stores and SCIS by tweaking the field sets.
Prerequisites
You have:
-
Complete understanding of Item Search API, including the usage of Item Search API Input Parameters.
-
Complete understanding of Field Sets.
Background
Fields such as Matrix Child Items (Detail)
, Related Items (Detail)
, and Correlated Items (Detail)
use the default field sets and retrieve a large number of item fields for each item. Consequently, the performance of pages that retrieve lot of matrix child items, related items, or correlated items degrade.
For example, the Matrix Child Items (Detail)
field retrieves matrix child item fields from the matrixchilditems
reserved field set. The matrixchilditems
field set has the following fields configured as part of Set Up Initial Field Sets:
onlinecustomerprice_detail, internalid, quantityavailable, outofstockbehavior, outofstockmessage, stockdescription, isinstock, isbackorderable, ispurchasable, showoutofstockmessage, itemid, minimumquantity, itemtype, isfulfillable, isstorepickupallowed, quantityavailableforstorepickup_detail
Solution
When retrieving item fields for the search result pages, you can specify an alternate field set to be loaded instead of the default field set using the Item Search API input parameters.
Use the following Item Search API parameters to override the default field set with any other field set:
-
For the
Matrix Child Items (Detail)
field, use the Item Search API parametermatrixchilditems_fieldset
. -
For the
Related Items (Detail)
field, use the Item Search API parameterrelateditems_fieldset
. -
For the
Correlated Items (Detail)
field, use the Item Search API parametercorrelateditems_fieldset
.
Example
In the following example, you can view that for each matrix child item about 15 item fields are retrieved. Consequently, the performance of pages that retrieve lot of matrix child items degrades.
http://www.mywebstore_suite.com/api/items?fieldset=details
{
"total": 10,
"items": [
{
"isinstock": true,
"metataghtml": "",
"custitem_ns_pr_item_attributes": " ",
"matrixchilditems_detail": [
{
"isinstock": true,
"itemid": "H2201100-110",
"ispurchasable": true,
"stockdescription": "",
"isbackorderable": true,
"onlinecustomerprice_detail": {
"onlinecustomerprice_formatted": "$15.99",
"onlinecustomerprice": 15.99
},
"internalid": 7541,
"showoutofstockmessage": false,
"outofstockbehavior": "- Default -",
"itemtype": "InvtPart",
"quantityavailable": 100,
"outofstockmessage": "",
"quantityavailableforstorepickup_detail": {
"locations": []
},
"isstorepickupallowed": false
},
{
"isinstock": false,
"itemid": "H2201100-274",
"ispurchasable": true,
"stockdescription": "",
"isbackorderable": true,
"onlinecustomerprice_detail": {
"onlinecustomerprice_formatted": "$15.99",
"onlinecustomerprice": 15.99
},
"internalid": 7542,
"showoutofstockmessage": false,
"outofstockbehavior": "- Default -",
"itemtype": "InvtPart",
"quantityavailable": 0,
"outofstockmessage": "",
"quantityavailableforstorepickup_detail": {
"locations": []
},
"isstorepickupallowed": false
}
],
.
.
.
.
To improve the performance of search result pages, you can now overwrite the default field set with any other field set using the Item Search API parameter matrixchilditems_fieldset
. Consider that we have created a new field set matrixchilditems_mini
, which has only four item fields. For more information, see To define your own field sets:.
In the following example, fewer matrix child item fields are returned as we have overwritten the default field set with a field set matrixchilditems_mini
(using the Item Search API parameter matrixchilditems_fieldset
):
http://www.mywebstore_suite.com/api/items?fieldset=details&matrixchilditems_fieldset=matrixchilditems_mini
{
"total": 10,
"items": [
{
"isinstock": true,
"metataghtml": "",
"custitem_ns_pr_item_attributes": " ",
"matrixchilditems_detail": [
{
"itemid": "H2201100-110",
"onlinecustomerprice_detail": {
"onlinecustomerprice_formatted": "$15.99",
"onlinecustomerprice": 15.99
},
"internalid": 7541,
"quantityavailable": 100,
},
{
"itemid": "H2201100-274",
"onlinecustomerprice_detail": {
"onlinecustomerprice_formatted": "$15.99",
"onlinecustomerprice": 15.99
},
"internalid": 7542,
"quantityavailable": 0,
}
],
.
.
.
.
If your search results page includes Related or Correlated items, you can further improve the performance by using the Item Search API parameters relateditems_fieldset
and correlateditems_fieldset
to overwrite the default field sets of the Related Items (Detail)
and Correlated Items (Detail)
fields respectively.