Skip to main content
GET
/
6
/
{hashid}
/
_search
Search query
curl --request GET \
  --url https://{search_zone}-search.doofinder.com/6/{hashid}/_search \
  --header 'Authorization: <api-key>'
{
  "custom_results_id": 5,
  "facets": [
    {
      "brand": {
        "terms": {
          "items": [
            {
              "name": "Adidas",
              "count": 5
            },
            {
              "name": "Nike",
              "count": 3
            }
          ],
          "selected": []
        }
      }
    }
  ],
  "query_name": "fuzzy",
  "results": [
    {
      "description": "The best product description ever",
      "dfid": "1234567890abcdef1234567890abcdef@product@1234567890abcdef",
      "id": "my_id",
      "image_url": "http://www.example.com/images/alt_product_image.jpg",
      "title": "My item",
      "url": "http://www.example.com/alt_product_description.htm"
    }
  ],
  "total": 1
}

Authorizations

Authorization
string
header
required

Doofinder API key. Pass it as: Authorization: Token <api_key>

Path Parameters

hashid
string
required

Unique id of a search engine.

Query Parameters

auto_filters
boolean

Enable/Disable auto filters feature in search. Default: false

custom_results
boolean

Enable/Disable custom_results feature in search. Default: true

excluded_results
boolean

Enable/Disable excluded items feature in the search. Default: true

exclude
string

Exclusive parameters are negative filters.

Doofinder expects the exclude parameters grouped like this:

exclude: { color: ['blue', 'red'], size: ['M', 'S'], price: { gte: 4.36, lt: 99 } }

For the range filters it can be used the following:

  • gte: Greater than or equal
  • lte: Less than or equal
  • gt: Greater than
  • lt: Less than

Writing that down in request parameters language is:

exclude[color][]=blue&exclude[color][]=red&exclude[size]=M&exclude[size]=S&exclude[price][gte]=4.36&exclude[price][lt]=99

Note that [ and ] characters should be escaped (%5B and %5D) in all exclude cases.

facets
object

Aggregates fields values in a facet, you could use a term facet or range facet. Read facets configuration for more deep info about facets.

The type of the facet (term or range) will be determined automatically.

Parameters:

  • field*: That is the field name that you want to aggregate results.
  • size: The number of results to return in each field. Only applicable to facet terms. Maximum: 50 by default to help maintain the speed of the search function. If you need more, please contact Doofinder support.
  • type: The facet type. Indicates the type of the facet, one of term or range. will return an error if the facet type is not correct.

*required parameter

Example request returning the brand term facet and the best_facet range facet:

facets[0][field]=brand&facets[0][size]=10&facets[1][field]=best_price.

filter
string

Filter parameters for items.

Doofinder expects the filter parameters grouped like this:

filter: { color: ['blue', 'red'], size: ['M', 'S'], price: { gte: 4.36, lt: 99 } }

Range filters can be used as follow:

  • gte: Greater than or equal
  • lte: Less than or equal
  • gt: Greater than
  • lt: Less than

Writing that down in request parameters language:

filter[color][]=blue&filter[color][]=red&filter[size][]=M&filter[size][]=S&filter[price][gte]=4.36&filter[price][lt]=99

Note that [ and ] characters should be escaped (%5B and %5D) in all filter cases.

filter_execution
enum<string>

Filters are applied with "and" boolean logic than means that all filters conditions should be met. If you want to apply any of the filters conditions, you can change it to "or".

Available options:
and,
or
grouping
boolean

Enable/Disable the grouping of variants as single items. If not given, it's taken from the configuration set in the admin.

with_variants
string[]

When provided and grouping is active, each hit includes a df_variants array containing all documents that share the same df_grouping_id, including the root (collapsed) document itself. The value is a list of document field names to include in each variant hit (e.g. with_variants[]=visual_variant). If the list is empty or grouping is off, this parameter has no effect.

indices
string[]

Your search engine is composed by one or many Indices. With the indices parameter you can specify to search within one specific Index. If this parameter is not provided, the search will work with all Indices.

For instance, if you want to search within the "product" Index you should use the following query:

indices[]=product

In case you want to search within multiple Indices, the query will be:

indices[]=product&indices[]=page

The order of the values do not affect the results order.

Note that [ and ] characters should be escaped (%5B and %5D) in all cases.

page
integer

page number of the results to return.

query
string

The search term. It must be escaped and it cannot be longer than 200 characters or 10 words.

query_name
enum<string>

This parameter is used to run a specific query type; normally search service uses the best query for the search being made.

The possible values for the query_name parameter are:

  • match_and: Doofinder will return results that contain all the search terms.
  • match_or: Doofinder will return results that contain any of the search terms. Of course, results that contain all the terms are scored better.
  • fuzzy: Doofinder will try to apply some «fuzzy logic» to determine whether a result, even if it’s not an exact match, is «close enough» to the search terms.
Available options:
match_and,
match_or,
fuzzy
rpp
integer

Results per page. how many results per page to return. Limits are rpp <= 100 and rpp * page < 1000.

session_id
string

The current session ID, must be unique for each user. Identifier of search session

Maximum string length: 32
user_id
string

Identifies the user, must be unique for each user. Identifier of user

Maximum string length: 36
stats
boolean

Enable/Disable this search in stats reports. Default: true

skip_auto_filters
string[]

A list of fields to be skipped from auto_filters feature.

skip_top_facet
string[]

A list of fields to be skipped from top_facet feature.

sort
string

Sorted results by certain fields.

Doofinder expects sort parameters like this:

sort: [{"price": "asc"}, {"brand": "desc"}]

Writing that down in request parameters language is:

sort[0][price]=asc&sort[1][brand]=desc

Note that [ and ] characters should be escaped (%5B and %5D) in all filter cases.

title_facet
boolean

Enable/Disable title_facet feature. Default: false

top_facet
boolean

Enable/Disable top_facet feature. Default: false

Response

OK

Search response. Some fields can not be included in the request if they have not data.

banner
Banner Response · object

Banner response for a query search.

count
integer

Total number of items found in the search engine for the searched term.

custom_results_id
integer

Id of applied custom results. This field will not be included if none of the custom results apply.

dynamic_boosting_rule_id
integer

Id of applied dynamic boosting rule. This field will not be included if none of the dynamic boosting rules apply.

facets
(Term Facet Response · object | Range Facet Response · object)[]

Information about different groupings that can be made for certain fields in the search results.

Facet terms search response. Used to aggregate a field by their values.

query_name
string

In order to get the best possible results, Doofinder tries several types of querying. This is the type of the query Doofinder made to obtain these results.

results
Item · object[]
total
integer

Total number of items that can be fetched.