Search Parameters

Here is the list of parameters that you can send when using the search endpoints.

Search

query

string

The text to search in the index.

If the text is empty or absent, the search will match every object in your index.

{
"query": "covid"
}

Pagination

page

integer default: 0

Page number of the results to fetch. When a page higher than the total number of pages is specified, an empty hits array is returned.

{
"page": 1 // will return hits of page 1
}

perPage

integer default: 20

Results per page (max 250)

{
"perPage": 5 // will return 5 hits per page
}

Properties

properties

Array<string>

Gives control over which properties to retrieve inside the records.

You may have some use cases where only a handful of properties inside the record may be needed for display purposes.

By setting this parameter, it will help optimize the response size.

{
"properties": ["property1", "property2"]
}

searchProperties

Array<string>

Gives control over which properties to search inside the records. The property needs to be searchable else it will be ignored.

You may only want to search inside the name property of a record for example.

{
"searchProperties": ["property1", "property2"]
}

Filtering

facetFilters

Array<string>

Filter hits by facet value or numeric value.

Value

Format: ${propertyName}:${value}

Numeric Comparisons

Format: ${propertyName} ${operator} ${operand}

Supported operators are <, <=, =, !=, >= and >, with the same semantics as in virtually all programming languages.

Numeric Range

Format: ${propertyName}:${lowerBound} TO ${upperBound}

Multiple filters: If you specify multiple filters, they are interpreted as a conjunction (AND). If you want to use a disjunction (OR), use a nested array.

{
"facetFilters": [
"property:value" // single value
// property1 = value AND property2 = value
"property1:value", "property2:value"
// property1 = value OR property2 = value
["property1:value", "property2:value"]
// (property3 = value OR property2 = value) AND property3 = value
["property1:value", "property2:value"], "property3:value"
]
}

Faceting

Array<string>

facets

Facets to retrieve.

Each of the specified facets, will be returned in the response as list of facet values in records matching the query and returned with its associated count (number of matched records containing the value).

Note

The property specified needs to be facetable.

{
"facets": ["services.en"]
}

Highlighting

highlightProperties

Array<string>

Gives control over which properties to highlight. The property needs to be searchable else it will be ignored.

{
"highlightProperties": ["property1", "property2"]
}

highlightPreTag

string

Use in conjunction with highlightPostTag to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <strong> and </strong> tags.

{
"highlightPreTag": "<em>"
}

highlightPostTag

string

Use in conjunction with highlightPreTag to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <strong> and </strong> tags.

{
"highlightPostTag": "</em>"
}

Geo Search

aroundLatLng

string

Search for entries around a central geolocation, enabling a geo search within a circular area.

{
"aroundLatLng": "lat,lng"
}

aroundRadius

integer | 'all'

Define the maximum radius for a geo search (in meters).

This parameter is only considered within the context of a radial geo search, enabled by specifing the aroundLatLng parameter.

  • If you specify the meters of the radius (instead of all), then only records that fall within the bounds of the circle will be returned.
  • If you use all, no filtering will be applied based on the radius.
  • If you do not specify this parameter, the radius is automatically computed from the density of the results.

insideBoundingBox

Array<floats>

Search inside a rectangular area (in geo coordinates).

{
"insideBoundingBox": [
[
northEastLat,
northEastLng,
southWestLat,
southWestLng,
],
[...] // it's possible to search in multiple bounding boxes
]
}

insidePolygon

Array<floats>

Search inside a polygon (in geo coordinates).

You may specify multiple polygons, in which case the search will yse the union (OR) of the polygons. To do this, pass either:

  • more than 6 values (must be a multiple of 2: 6, 8, 12...); examples: 47.3165,4.9665,47.3424,5.0201,40.9234,2.1185,38.6430,1.9916,39.6430,2.9916
  • a list of list of float (each inner array must contains at least 6 values); example: [[47.3165,4.9665,47.3424,5.0201,40.9234,2.1185,38.6430,1.9916,39.6430,2.9916]]

aroundLatLng, aroundLatLngViaIP and insideBoundingBox will be ignored if used along with this parameter.

{
"insidePolygon": [
-73.47862243652344,
45.70474073467439,
-73.62831115722656,
45.62460302647399,
-73.68049621582031,
45.54915936139622,
-73.75602722167969,
45.51260243872574,
-73.84597778320312,
45.51741391767134,
-73.90228271484375,
45.46253867087026,
-73.93112182617188,
45.47265128615832,
-73.94622802734375,
45.45820413751095,
-73.93867492675781,
45.451460867719966,
-73.97369384765625,
45.43556282712783,
-73.95240783691405,
45.40230699238177,
-73.82194519042969,
45.43074435456533,
-73.6090850830078,
45.41676845766787,
-73.53080749511717,
45.46783598133375,
-73.47862243652344,
45.70474073467439
]
}

Query Strategy

queryType

string default: prefix_none

Controls if and how query words are interpreted as prefixes.

  • prefix_none: No query word is interpreted as a prefix
  • prefix_last: Only the last word is interpreted as a prefix
  • prefix_all: All the words are interpredted as a prefix
{
"queryType": "prefix_last"
}