Get search result with filter fields

Hi, I’m building a mobile app integrated with VTEX API and would like to implement a product search screen with filters. I saw that there are the Get Specifications By Category ID and Get Specification Values By Field ID endpoints that could be used for a search within a specific category, but is there a way to do this in a generic search?

Hi @Victorers , according to the search api documentation, it is possible to use filters using some queryParams.

to filter by category = fq=C:/1/2

to filter by specification = fq=specificationFilter_{specificationID}:{specificationValue}

to filter by price range = fq=P:[10 TO 20]

and you can combine them by separating them with a “,”.

An example:

https://{accountName}.{environment}.com.br/api/catalog_system/pub/products/search?_from=1&_to=10&O=OrderByPriceASC&fq=C:/1/2,P:[28 TO 30],specificationFilter_123:Blue

I hope it helped you.

2 Likes

Thanks for the clarification, but I want to know how to retrieve which specifications are applicable for a given search, so that I can use the fq=specificationFilter_{specificationID}:{specificationValue} parameter.

If I do, for example, a search with the term “paints”, I would like to receive which specifications make sense for the products in the result (they could be color, brand, composition, etc). A search for the term “floors” should contain different filter options, such as color, shape, dimension, etc.

The objective is to build a component in the app that is equivalent to this on websites:

Pasted Graphic

2 Likes

Hi @Victorers , sorry if I didn’t understand your question, to get this information take a look at this api
Intelligent Search API, with it you should be able to get this data.

According to the documentation, you can search for a term using the following query string:

query={termToSearch}

the url should look like this:

https://{accountName}.{environment}.com.br/api/io/_v/api/intelligent-search/facets/?query=paints

1 Like

Hi @Victorers

Take a look at this documentation to see if it helps:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.