number

Purpose

Finds documents that contain numbers.

Syntax

number([restriction type,N1,[N2]])

Arguments

This function has no required arguments. When called without arguments, the function matches all numbers.

The arguments restriction_type, N1 and N2 are optional and are used to find numbers in a specific range. The restriction_type argument takes one of the following values:

Restriction type

Explanation

</less/lt

number is less than N1

<=/le/less or equal/less_equal

number is less than N1 or equal to N1

>/gt/greater

number is greater than N1

>=/ge/greater or equal/greater_equal

number is greater than N1 or equal to N1

=/eq/equal

number is equal to N1

!=/ne/not equal/not_equal

number is not equal to N1

()/bt/between

number belongs to the interval (N1, N2)

[]/be/between or equal/between_equal

number belongs to the interval [N1, N2]

(]/lo/left-open/left_open

number belongs to the interval (N1, N2]

[)/ro/right-open/right_open

number belongs to the interval [N1, N2)

If the restriction_type consists of mathematical symbols, they should be enclosed in quotes (">", "()", "!=", etc.).

If the restriction_type name consists of two or more words or contains a hyphen, it should also be enclosed in quotes ("not equal", "between or equal", "right-open").

The negative value of an argument should also be enclosed in quotes, e.g. number(less, "-3").

The function also supports optional named parameters:

  • allow_multiword : if the option is enabled, numbers written in several words (two hundred, one million) are treated as a single unit and correctly converted into a numerical value. Using this option may result in performance loss.

  • type:=numeral: matches numbers consisting of digits and symbols, permitted to use within numbers (e.g., dots, slashes etc.)

  • type:=digit: matches numbers consisting of digits only, without any symbols, permitted to use within numbers

  • type:=word: matches numbers written in words

  • type:=any: matches numbers written in both words and digits

Returned Value

Documents matching the query.

Examples

number() matches all numbers.

number(less, 2) = number(lt, 2) = number("<", 2) matches numbers < 2.

number(between_equal, "-1", 5) = number(be, "-1", 5) = number("[]", "-1", 5) matches numbers <= 5 and >= -1.

number(greater, 2, type:=word) matches "two", "three", "four", etc.

number(greater, 100, type:=word, allow_multiword:=yes) matches "two hundred", "three million", "million", etc.

number(greater, 2, type:=digit) matches "4", "5, etc.

number(greater, 2, type:=numeral) matches "2.3", "5,5", "3", etc.

number(greater, 2, type:=any) matches "three", "3", "2.3", etc.

number(greater, 2, type:=digit|word) matches "three", "3", "4", "four", etc.