numericFilters

Type: list of strings
Engine default: []
Parameter syntax
'numericFilters' => [
  'numeric_attribute = | != | > | >= | < | <= numeric_value',
  'attribute:lower_value TO higher_value',
  ...
]
Parameter syntax
numericFilters: [
  'numeric_attribute = | != | > | >= | < | <= numeric_value',
  'attribute:lower_value TO higher_value',
  ...
]
Parameter syntax
numericFilters: [
  'numeric_attribute = | != | > | >= | < | <= numeric_value',
  'attribute:lower_value TO higher_value',
  ...
]
Parameter syntax
'numericFilters': [
  'numeric_attribute = | != | > | >= | < | <= numeric_value',
  'attribute:lower_value TO higher_value',
  ...
]
Parameter syntax
query.numericFilters = [
  "numeric_attribute = | != | > | >= | < | <= numeric_value",
  "attribute:lower_value TO higher_value"
]
Parameter syntax
.setNumericFilters(
  new JSONArray()
    .put("numeric_attribute = | != | > | >= | < | <= numeric_value")
    .put("attribute:lower_value TO higher_value")
)
Parameter syntax
.SetNumericFilters(@"
  numeric_attribute = | != | > | >= | < | <= numeric_value,
  attribute:lower_value TO higher_value
")
Parameter syntax
.setNumericFilters(Arrays.asList(
  "numeric_attribute = | != | > | >= | < | <= numeric_value",
  "attribute:lower_value TO higher_value",
  ...
))
Parameter syntax
"numericFilters": []interface{}{
  "numeric_attribute = | != | > | >= | < | <= numeric_value",
  "attribute:lower_value TO higher_value"
}
Parameter syntax
numericFilters = Some(Seq(
  "numeric_attribute = | != | > | >= | < | <= numeric_value",
  "attribute:lower_value TO higher_value"
))

Can be used in these methods:
search, browse, deleteBy, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, browse, delete_by, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, browse, deleteBy, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, browse, delete_by, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, browse, deleteBy, searchForFacetValues searchAsync, browseAsync, deleteByAsync, searchForFacetValues Search, Browse, DeleteBy, SearchForFacetValues, GenerateSecuredApiKey, AddApiKey, UpdateApiKey Search, browse, deleteBy, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey Search, Browse, DeleteBy, SearchForFacetValues, GenerateSecuredAPIKey, AddAPIKey, UpdateAPIKey search, browse index, delete by, search into facet values, generateSecuredApiKey, add key, update key

About this parameter

Filter on numeric attributes.

The filters parameter provides an easier to use, SQL-like syntax. We recommend using it instead of this setting.

Numeric Comparisons

Format: ${attributeName} ${operator} ${operand}
Example: inStock > 0.

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


Numeric Range

Format: ${attributeName}:${lowerBound} TO ${upperBound}
Example: price:5.99 TO 100

${lowerBound} and ${upperBound} must be numeric. Both are inclusive.



Usage notes:
  • No boolean operators: You cannot use boolean operators like AND and OR.

  • 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.

Examples

Apply numeric filters filters on a search query

<?php
$results = $index->search('query', [
  'numericFilters' => [
    [
      "inStock > 0",
      "deliveryDate < 1441755506"
    ],
    "price < 1000"
  ]
]);
results = index.search('query', {
  numericFilters: [
    [
      'inStock > 0',
      'deliveryDate < 1441755506'
    ],
    'price < 1000'
  ]
})
index.search({
  query: 'query',
  numericFilters: [
    [
      'inStock > 0',
      'deliveryDate < 1441755506'
    ],
    'price < 1000'
  ]
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
  'numericFilters': [
    [
      "inStock > 0",
      "deliveryDate < 1441755506"
    ],
    "price < 1000"
  ]
})
let query = Query(query: "query")
query.numericFilters = [
  [
    "inStock > 0",
    "deliveryDate < 1441755506"
  ],
  "price < 1000"
]

index.search(query, completionHandler: { (res, error) in
  print(res)
})
index.search(
  new Query("query").setNumericFilters(
    new JSONArray()
      .put(
        new JSONArray()
          .put("inStock > 0")
          .put("deliveryDate < 1441755506")
      )
      .put("price < 1000")
  )
);
index.search(
  new Query("query").SetNumericFilters(@"
    (inStock > 0, deliveryDate < 1441755506),
    price < 1000
  ")
);
index.search(
  new Query("query").setNumericFilters(
    Arrays.asList(
      Arrays.asList(
        "inStock > 0",
        "deliveryDate < 1441755506"
      )
      "price < 1000"
    )
  )
);
res, err := index.Search("query", algoliasearch.Map{
  "numericFilters": []interface{}{
    []string{
      "inStock > 0",
      "deliveryDate < 1441755506",
    },
    "price < 1000",
  },
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    numericFilters = Some(Seq(
      Some(Seq(
        "inStock > 0",
        "deliveryDate < 1441755506"
      )),
      "price < 1000"
    ))
  )
}
  • [["inStock > 0", "deliveryDate < 1441755506"], "price < 1000"] translates as (inStock > 0 OR deliveryDate < 1441755506) AND price < 1000
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala