count

Purpose

Returns documents that contain a specified number of words/phrases matched by the query.

Syntax

count([[restriction_type], [N1], [N2],] term)

Arguments

The first optional parameters restriction_type, N1 and N2 are used to specify number of words/phrases that must match the query.

N1 and optionally N2 are used to specify either reference value or endpoints of the interval.

The restriction_type parameter accepts one of the following values:

restriction_type

synonym

description

less

lt; <

number of words matched by the query should be less than [N1]

less or equal

le; <=; less_equal

number of words matched by the query should be less than or equal to [N1]

greater

gt; >

number of words matched by the query should be greater than [N1]

greater or equal

ge; >=; greater_equal

number of words matched by the query should be greater than or equal to [N1]

equal

eq; =

number of words matched by the query should be equal to [N1]

not equal

ne; !=; not_equal

number of words matched by the query should not be equal to [N1]

between

bt; ()

number of words matched by the query should be between N1 and N2

between or equal

be; []; between_equal

number of words matched by the query should be between N1 and N2, including N1 and N2

left-open

lo; (]; left_open

number of words matched by the query should be between N1 and N2, including N2

right-open

ro; [); right_open

number of words matched by the query should be between N1 and N2, including N1

The default value of the parameter is set to "equal".

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").

If no explicit restriction_type or reference values are specified, the function returns all documents matched by the query regardless of the number of matches.

Returned Value

Number of words matched by the query

Examples

count(company) matches documents that contain word "company".

count(3, company) = count(equal, 3, company) matches documents that contain three occurrences of the word "company".

count(greater, 3, company) = count(">", 3, company) matches documents that contain more than three occurrences of the word "company".

count(between, 2, 5, company) = count("()", 2, company) matches documents that contain from 2 to 5 occurrences of the word "company".

count(greater, 2, sentence(product, market)) = count(">", 2, sentence(product, market)) = count(gt, 2, sentence(product, market)) matches "Though the leading companies hold dominant positions in the market, innovation and better product development can alter the market dynamics" (document contains three words that match the query), but not "The market for products enabled by nanotechnologies will reach US$ 263 billion by 2012" (document contains two words that match the query).