Developer forum

Forum » Templates » Getting Index facets async

Getting Index facets async

Kasper Legarth
Reply

Hello.

Our customer has a product page with a lot of facets. Some of the facets have a lot of options.
The customer do not want to cut down on the facet, but still want better performance. Right now the page loads in everything from 2.5 - 5 seconds.
If I use debug=true on the page I can see, as expected that the index query take up about 90% of the load time. And the "DoFacetSearch" is the sinner. 

Is there any way to get the facets async, trough the API or anything like that? Haven't been able to find any thing in the swagger.


Kind regards
Kasper.

screen1.png

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kasper

You can indeed - the search endpoint (comes in both a post and get version) will return facets if available on the search - below is an example:

http://swiftdemo.dynamicweb-cms.com/dwapi/ecommerce/products/search?RepositoryName=SwiftProducts&QueryName=Products&ProductSettings.FilledProperties=Name&FilledProperties=Products,FacetGroups,TotalProductsCount

?RepositoryName=SwiftProducts
&QueryName=Products
&FilledProperties=Products,FacetGroups,TotalProductsCount
&ProductSettings.FilledProperties=Name

As you can see, a repository and a query has been specified - and the facets related to that will be returned - here I used the FilledProperties to limit the properties being returned from the API.

The result will be something like this:

{
  "Products": [
    {
      "Name": "K2 T:Nine Alliance Ladies Road Bike cc"
    },
    {
      "Name": "K2 Astral 4.0 Road Bike"
    },
    {
      "Name": "Schwinn Prologue Road Bike"
    },
    {
      "Name": "GTw Legato 2.0 Lady"
    },
    {
      "Name": "Mongoose Sabrosa Ocho Commuter"
    },
    {
      "Name": "GTR Pro Rival Road Bike"
    },
    {
      "Name": "Mongoose Supergoose Cruiser BMX"
    },
    {
      "Name": "GTw Avalanche 3.0 Disc Ladies"
    },
    {
      "Name": "GT Marathon 2.0 Mountain Bike"
    },
    {
      "Name": "Schwinn Sid Coasting Bike"
    }
  ],
  "TotalProductsCount": 689,
  "FacetGroups": [
    {
      "Name": "Electricals",
      "Facets": [
        {
          "QueryParameter": "ElectricalType",
          "RenderType": "Checkboxes",
          "FacetField": "ElectricalType_facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "center",
              "Label": "Center",
              "Value": "center",
              "Count": 16
            },
            {
              "Name": "front",
              "Label": "Front",
              "Value": "front",
              "Count": 1
            }
          ],
          "OptionCount": 2,
          "OptionActiveCount": 2,
          "OptionResultTotalCount": 17
        },
        {
          "QueryParameter": "ElectricalModel",
          "RenderType": "Checkboxes",
          "FacetField": "ElectricalModel_facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "Active Line",
              "Label": "Active Line",
              "Value": "Active Line",
              "Count": 2
            },
            {
              "Name": "SHIMANO STEPS E5000",
              "Label": "SHIMANO STEPS E5000",
              "Value": "SHIMANO STEPS E5000",
              "Count": 2
            },
            {
              "Name": "SHIMANO STEPS E6100",
              "Label": "SHIMANO STEPS E6100",
              "Value": "SHIMANO STEPS E6100",
              "Count": 2
            },
            {
              "Name": "SHIMANO STEPS E8000 (EP8)",
              "Label": "SHIMANO STEPS E8000 (EP8)",
              "Value": "SHIMANO STEPS E8000 (EP8)",
              "Count": 10
            }
          ],
          "OptionCount": 4,
          "OptionActiveCount": 4,
          "OptionResultTotalCount": 16
        },
        {
          "QueryParameter": "ElectricalControlPanel",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|electronic_engine_system|control_panel",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "diode",
              "Label": "Diode light",
              "Value": "diode",
              "Count": 1
            },
            {
              "Name": "lcd",
              "Label": "LCD panel",
              "Value": "lcd",
              "Count": 12
            }
          ],
          "OptionCount": 2,
          "OptionActiveCount": 2,
          "OptionResultTotalCount": 13
        },
        {
          "QueryParameter": "ElectricalBatteryType",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|electronic_engine_system|battery_type",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "Lithium-Ion",
              "Label": "Lithium-Ion",
              "Value": "Lithium-Ion",
              "Count": 17
            }
          ],
          "OptionCount": 1,
          "OptionActiveCount": 1,
          "OptionResultTotalCount": 17
        }
      ]
    },
    {
      "Name": "Products.facets",
      "Facets": [
        {
          "QueryParameter": "Brand",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "Brand_Facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "Adidas",
              "Label": "Adidas",
              "Value": "Adidas",
              "Count": 4
            },
            {
              "Name": "Bell",
              "Label": "Bell",
              "Value": "Bell",
              "Count": 6
            },
            {
              "Name": "Cannondale",
              "Label": "Cannondale",
              "Value": "Cannondale",
              "Count": 1
            },
            {
              "Name": "Crank Brothers",
              "Label": "Crank Brothers",
              "Value": "Crank Brothers",
              "Count": 5
            },
            {
              "Name": "E-totem",
              "Label": "E-totem",
              "Value": "E-totem",
              "Count": 2
            },
            {
              "Name": "Forté",
              "Label": "Forté",
              "Value": "Forté",
              "Count": 5
            },
            {
              "Name": "Giro",
              "Label": "Giro",
              "Value": "Giro",
              "Count": 2
            },
            {
              "Name": "GT bicycles",
              "Label": "GT bicycles",
              "Value": "GT bicycles",
              "Count": 10
            },
            {
              "Name": "K2 bikes",
              "Label": "K2 bikes",
              "Value": "K2 bikes",
              "Count": 7
            },
            {
              "Name": "Lynskey",
              "Label": "Lynskey",
              "Value": "Lynskey",
              "Count": 7
            },
            {
              "Name": "Mavic",
              "Label": "Mavic",
              "Value": "Mavic",
              "Count": 4
            },
            {
              "Name": "Merida",
              "Label": "Merida",
              "Value": "Merida",
              "Count": 26
            },
            {
              "Name": "Mongoose",
              "Label": "Mongoose",
              "Value": "Mongoose",
              "Count": 12
            },
            {
              "Name": "Nirve",
              "Label": "Nirve",
              "Value": "Nirve",
              "Count": 3
            },
            {
              "Name": "Pearl",
              "Label": "Pearl",
              "Value": "Pearl",
              "Count": 2
            },
            {
              "Name": "Performance",
              "Label": "Performance",
              "Value": "Performance",
              "Count": 10
            },
            {
              "Name": "Ritchey",
              "Label": "Ritchey",
              "Value": "Ritchey",
              "Count": 1
            },
            {
              "Name": "Scattante",
              "Label": "Scattante",
              "Value": "Scattante",
              "Count": 13
            },
            {
              "Name": "Schwinn",
              "Label": "Schwinn",
              "Value": "Schwinn",
              "Count": 6
            },
            {
              "Name": "Selle",
              "Label": "Selle",
              "Value": "Selle",
              "Count": 4
            },
            {
              "Name": "Shimano",
              "Label": "Shimano",
              "Value": "Shimano",
              "Count": 7
            },
            {
              "Name": "Terry",
              "Label": "Terry",
              "Value": "Terry",
              "Count": 4
            },
            {
              "Name": "Time",
              "Label": "Time",
              "Value": "Time",
              "Count": 1
            }
          ],
          "OptionCount": 23,
          "OptionActiveCount": 23,
          "OptionResultTotalCount": 142
        },
        {
          "QueryParameter": "Gender",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "Gender_Facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "boys",
              "Label": "Boys",
              "Value": "boys",
              "Count": 1
            },
            {
              "Name": "men",
              "Label": "Men",
              "Value": "men",
              "Count": 50
            },
            {
              "Name": "unisex",
              "Label": "Unisex",
              "Value": "unisex",
              "Count": 14
            },
            {
              "Name": "women",
              "Label": "Women",
              "Value": "women",
              "Count": 16
            }
          ],
          "OptionCount": 4,
          "OptionActiveCount": 4,
          "OptionResultTotalCount": 81
        },
        {
          "QueryParameter": "Color",
          "QueryParameterType": "System.String[]",
          "RenderType": "Colors",
          "FacetField": "VariantGroup_VARGRP1",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "VO2",
              "Label": "Black",
              "Value": "VO2",
              "Sort": 2,
              "Count": 1
            },
            {
              "Name": "VO3",
              "Label": "Blue",
              "Value": "VO3",
              "Sort": 5,
              "Count": 3
            },
            {
              "Name": "VO5",
              "Label": "Green",
              "Value": "VO5",
              "Sort": 4,
              "Count": 1
            },
            {
              "Name": "VO1",
              "Label": "Red",
              "Value": "VO1",
              "Sort": 1,
              "Count": 3
            }
          ],
          "OptionCount": 4,
          "OptionActiveCount": 4,
          "OptionResultTotalCount": 8
        },
        {
          "QueryParameter": "Sizes",
          "RenderType": "Checkboxes",
          "FacetField": "VariantGroup_VARGRP2",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "VO14",
              "Label": "L",
              "Value": "VO14",
              "Sort": 10,
              "Count": 24
            },
            {
              "Name": "VO13",
              "Label": "M",
              "Value": "VO13",
              "Sort": 9,
              "Count": 25
            },
            {
              "Name": "VO12",
              "Label": "S",
              "Value": "VO12",
              "Sort": 8,
              "Count": 24
            },
            {
              "Name": "VO15",
              "Label": "XL",
              "Value": "VO15",
              "Sort": 11,
              "Count": 23
            },
            {
              "Name": "VO11",
              "Label": "XS",
              "Value": "VO11",
              "Sort": 7,
              "Count": 9
            },
            {
              "Name": "VO16",
              "Label": "XXL",
              "Value": "VO16",
              "Sort": 12,
              "Count": 9
            }
          ],
          "OptionCount": 6,
          "OptionActiveCount": 6,
          "OptionResultTotalCount": 114
        },
        {
          "QueryParameter": "Bike type",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|Bike_type",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "city",
              "Label": "City",
              "Value": "city",
              "Count": 20
            },
            {
              "Name": "mountain",
              "Label": "Mountain",
              "Value": "mountain",
              "Count": 13
            },
            {
              "Name": "roadbike",
              "Label": "Road bike",
              "Value": "roadbike",
              "Count": 34
            },
            {
              "Name": "trekking",
              "Label": "Trekking",
              "Value": "trekking",
              "Count": 3
            }
          ],
          "OptionCount": 4,
          "OptionActiveCount": 4,
          "OptionResultTotalCount": 70
        },
        {
          "QueryParameter": "Wheel size",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|Wheel_size",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "26",
              "Label": "26\"",
              "Value": "26",
              "Count": 4
            },
            {
              "Name": "27.5",
              "Label": "27,5\"",
              "Value": "27.5",
              "Count": 6
            },
            {
              "Name": "28",
              "Label": "28\"",
              "Value": "28",
              "Count": 5
            },
            {
              "Name": "29",
              "Label": "29\"",
              "Value": "29",
              "Count": 9
            },
            {
              "Name": "700",
              "Label": "700c",
              "Value": "700",
              "Count": 29
            }
          ],
          "OptionCount": 5,
          "OptionActiveCount": 5,
          "OptionResultTotalCount": 53
        },
        {
          "QueryParameter": "Gear",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|Gear",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "11",
              "Label": "11\"",
              "Value": "11",
              "Count": 1
            },
            {
              "Name": "12",
              "Label": "12\"",
              "Value": "12",
              "Count": 3
            },
            {
              "Name": "18",
              "Label": "18\"",
              "Value": "18",
              "Count": 14
            },
            {
              "Name": "20",
              "Label": "20\"",
              "Value": "20",
              "Count": 4
            },
            {
              "Name": "21",
              "Label": "21\"",
              "Value": "21",
              "Count": 19
            },
            {
              "Name": "22",
              "Label": "22\"",
              "Value": "22",
              "Count": 1
            },
            {
              "Name": "27",
              "Label": "27\"",
              "Value": "27",
              "Count": 7
            }
          ],
          "OptionCount": 7,
          "OptionActiveCount": 7,
          "OptionResultTotalCount": 49
        },
        {
          "QueryParameter": "Gear_Model",
          "RenderType": "Checkboxes",
          "FacetField": "GearModel_facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "NULL",
              "Label": "NULL",
              "Value": "NULL"
            },
            {
              "Name": "Shimano 105",
              "Label": "Shimano 105",
              "Value": "Shimano 105",
              "Count": 2
            },
            {
              "Name": "Shimano 105, 11 speed",
              "Label": "Shimano 105, 11 speed",
              "Value": "Shimano 105, 11 speed",
              "Count": 4
            },
            {
              "Name": "Shimano Altus",
              "Label": "Shimano Altus",
              "Value": "Shimano Altus",
              "Count": 4
            },
            {
              "Name": "Shimano Altus EF51, 7 gear",
              "Label": "Shimano Altus EF51, 7 gear",
              "Value": "Shimano Altus EF51, 7 gear",
              "Count": 1
            },
            {
              "Name": "Shimano Deore M591",
              "Label": "Shimano Deore M591",
              "Value": "Shimano Deore M591",
              "Count": 7
            },
            {
              "Name": "Shimano Deore M5100",
              "Label": "Shimano Deore M5100",
              "Value": "Shimano Deore M5100",
              "Count": 1
            },
            {
              "Name": "Shimano Deore M6100",
              "Label": "Shimano Deore M6100",
              "Value": "Shimano Deore M6100",
              "Count": 1
            },
            {
              "Name": "Shimano Deore XT M8050",
              "Label": "Shimano Deore XT M8050",
              "Value": "Shimano Deore XT M8050",
              "Count": 2
            },
            {
              "Name": "Shimano Deore XT M8100",
              "Label": "Shimano Deore XT M8100",
              "Value": "Shimano Deore XT M8100",
              "Count": 4
            },
            {
              "Name": "Shimano Dura Ace 9150 SS",
              "Label": "Shimano Dura Ace 9150 SS",
              "Value": "Shimano Dura Ace 9150 SS",
              "Count": 10
            },
            {
              "Name": "Shimano SLX M7100",
              "Label": "Shimano SLX M7100",
              "Value": "Shimano SLX M7100",
              "Count": 5
            },
            {
              "Name": "Shimano Tiagra, 10 speed",
              "Label": "Shimano Tiagra, 10 speed",
              "Value": "Shimano Tiagra, 10 speed",
              "Count": 5
            },
            {
              "Name": "Shimano Ultegra",
              "Label": "Shimano Ultegra",
              "Value": "Shimano Ultegra"
            },
            {
              "Name": "Shimano Ultegra DI2",
              "Label": "Shimano Ultegra DI2",
              "Value": "Shimano Ultegra DI2",
              "Count": 7
            },
            {
              "Name": "Shimano XT",
              "Label": "Shimano XT",
              "Value": "Shimano XT",
              "Count": 1
            },
            {
              "Name": "Shimano XT M8100",
              "Label": "Shimano XT M8100",
              "Value": "Shimano XT M8100",
              "Count": 1
            },
            {
              "Name": "Shimano XTR DI2 RD-M905",
              "Label": "Shimano XTR DI2 RD-M905",
              "Value": "Shimano XTR DI2 RD-M905",
              "Count": 4
            },
            {
              "Name": "Sram Red eTAP AXS",
              "Label": "Sram Red eTAP AXS",
              "Value": "Sram Red eTAP AXS",
              "Count": 5
            }
          ],
          "OptionCount": 19,
          "OptionActiveCount": 19,
          "OptionResultTotalCount": 64
        },
        {
          "QueryParameter": "Brake type",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|Brake_type",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "caliper",
              "Label": "Caliper",
              "Value": "caliper",
              "Count": 1
            },
            {
              "Name": "hydraulic_disc",
              "Label": "Hydraulic disc",
              "Value": "hydraulic_disc",
              "Count": 13
            },
            {
              "Name": "integrated",
              "Label": "Integrated",
              "Value": "integrated",
              "Count": 2
            },
            {
              "Name": "linear_pull",
              "Label": "Linear-pull",
              "Value": "linear_pull",
              "Count": 30
            },
            {
              "Name": "mechanical_disc",
              "Label": "Mechanical disc",
              "Value": "mechanical_disc",
              "Count": 11
            }
          ],
          "OptionCount": 5,
          "OptionActiveCount": 5,
          "OptionResultTotalCount": 57
        },
        {
          "QueryParameter": "Additional",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|add_equipment",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "basket",
              "Label": "Basket",
              "Value": "basket"
            },
            {
              "Name": "bell",
              "Label": "Bell",
              "Value": "bell",
              "Count": 7
            },
            {
              "Name": "Bottle_holder",
              "Label": "Bottle holder",
              "Value": "Bottle_holder",
              "Count": 1
            },
            {
              "Name": "light",
              "Label": "Light",
              "Value": "light",
              "Count": 8
            },
            {
              "Name": "lock",
              "Label": "Lock",
              "Value": "lock",
              "Count": 8
            },
            {
              "Name": "luggage_racks",
              "Label": "Luggage racks",
              "Value": "luggage_racks",
              "Count": 7
            },
            {
              "Name": "pump",
              "Label": "Pump",
              "Value": "pump",
              "Count": 3
            },
            {
              "Name": "stands",
              "Label": "Stands",
              "Value": "stands",
              "Count": 5
            }
          ],
          "OptionCount": 8,
          "OptionActiveCount": 8,
          "OptionResultTotalCount": 39
        },
        {
          "QueryParameter": "Suspension",
          "QueryParameterType": "System.String[]",
          "RenderType": "Checkboxes",
          "FacetField": "Suspension_facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "Full suspension",
              "Label": "Full suspension",
              "Value": "Full suspension",
              "Count": 8
            },
            {
              "Name": "Hardtail",
              "Label": "Hardtail",
              "Value": "Hardtail",
              "Count": 9
            }
          ],
          "OptionCount": 2,
          "OptionActiveCount": 2,
          "OptionResultTotalCount": 17
        },
        {
          "QueryParameter": "Material_usage",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike|Material_usage",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "ABS",
              "Label": "ABS",
              "Value": "ABS",
              "Count": 2
            },
            {
              "Name": "Aluminium",
              "Label": "Aluminium",
              "Value": "Aluminium",
              "Count": 3
            },
            {
              "Name": "Aluminum",
              "Label": "Aluminum",
              "Value": "Aluminum",
              "Count": 44
            },
            {
              "Name": "Carbon",
              "Label": "Carbon",
              "Value": "Carbon",
              "Count": 17
            },
            {
              "Name": "Plastic",
              "Label": "Plastic",
              "Value": "Plastic",
              "Count": 11
            },
            {
              "Name": "PVC",
              "Label": "PVC",
              "Value": "PVC",
              "Count": 2
            },
            {
              "Name": "Steel",
              "Label": "Steel",
              "Value": "Steel",
              "Count": 17
            },
            {
              "Name": "Titanium",
              "Label": "Titanium",
              "Value": "Titanium",
              "Count": 2
            },
            {
              "Name": "Zinc",
              "Label": "Zinc",
              "Value": "Zinc",
              "Count": 2
            }
          ],
          "OptionCount": 9,
          "OptionActiveCount": 9,
          "OptionResultTotalCount": 100
        },
        {
          "QueryParameter": "TextileComposition",
          "RenderType": "Checkboxes",
          "FacetField": "ProductCategory|Reference_Bike_clothing|composition",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "cotton",
              "Label": "Cotton",
              "Value": "cotton",
              "Count": 9
            },
            {
              "Name": "leather",
              "Label": "Leather",
              "Value": "leather",
              "Count": 3
            },
            {
              "Name": "nylon",
              "Label": "Nylon",
              "Value": "nylon",
              "Count": 10
            },
            {
              "Name": "polyester",
              "Label": "Polyester",
              "Value": "polyester",
              "Count": 2
            },
            {
              "Name": "spandex",
              "Label": "Spandex",
              "Value": "spandex",
              "Count": 7
            },
            {
              "Name": "viscose",
              "Label": "Viscose",
              "Value": "viscose",
              "Count": 8
            }
          ],
          "OptionCount": 6,
          "OptionActiveCount": 6,
          "OptionResultTotalCount": 39
        },
        {
          "QueryParameter": "TextileForm",
          "RenderType": "Checkboxes",
          "FacetField": "TextileForm_facet",
          "FacetType": "Field",
          "FacetValue": "",
          "Options": [
            {
              "Name": "Adjustable",
              "Label": "Adjustable",
              "Value": "Adjustable",
              "Count": 2
            },
            {
              "Name": "Fitted",
              "Label": "Fitted",
              "Value": "Fitted",
              "Count": 1
            },
            {
              "Name": "Fitted cuff",
              "Label": "Fitted cuff",
              "Value": "Fitted cuff",
              "Count": 3
            },
            {
              "Name": "NULL",
              "Label": "NULL",
              "Value": "NULL",
              "Count": 13
            },
            {
              "Name": "Regular",
              "Label": "Regular",
              "Value": "Regular",
              "Count": 3
            },
            {
              "Name": "Regular fit",
              "Label": "Regular fit",
              "Value": "Regular fit",
              "Count": 6
            },
            {
              "Name": "Skinny fit",
              "Label": "Skinny fit",
              "Value": "Skinny fit",
              "Count": 2
            },
            {
              "Name": "Skinny fit – cut closely to the body",
              "Label": "Skinny fit – cut closely to the body",
              "Value": "Skinny fit – cut closely to the body",
              "Count": 3
            },
            {
              "Name": "Skinny fit pants",
              "Label": "Skinny fit pants",
              "Value": "Skinny fit pants",
              "Count": 2
            },
            {
              "Name": "Slim",
              "Label": "Slim",
              "Value": "Slim",
              "Count": 5
            },
            {
              "Name": "Slim fit",
              "Label": "Slim fit",
              "Value": "Slim fit",
              "Count": 2
            }
          ],
          "OptionCount": 11,
          "OptionActiveCount": 11,
          "OptionResultTotalCount": 42
        }
      ]
    },
    {
      "Name": "Type ahead",
      "Facets": []
    }
  ]
}

​

Votes for this answer: 1
 
Kasper Legarth
Reply

Thanks Nicolai. 

Just what i needed :)

 
Kasper Legarth
Reply

@Nicolai

Follow up question.

Is there any further documentation to the Web API?
Is there a way to restrict the facets to the current ecom state? Like if you use them throuthe product catalog app?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

It is the exact same engine that run both - so the querystring parameters you add to the regular page using the product catalog, are the same you add to the endpoint.

In the example above, there is a facegroup called "Electricals" - there you can see the queryparameter as defined in the query and facet defintions in the backend.

So you can add ElectricalType=front or ElectricalType=center which are the valid values for that facet - as found in the options section of the json

That gives you a URL like below:

http://swiftdemo.dynamicweb-cms.com/dwapi/ecommerce/products/search?RepositoryName=SwiftProducts&QueryName=Products&ProductSettings.FilledProperties=Name&FilledProperties=Products,FacetGroups,TotalProductsCount&ElectricalType=front

And then the counts of the facets will change exactly like on your regular frontend - you can also search for products and all the same as you are used to.

BR Nicolai

 
Kasper Legarth
Reply

You are a hero.

Thanks a lot.

 

You must be logged in to post in the forum