ARRAY Predicate
Note
Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.
The ARRAY (or Vector) predicate performs comparisons of two arrays using logical operators. This predicate is an optional part of the optional WHERE clause of the SELECT statement.
SELECT Select_List | *
FROM_Clause
[WHERE Column_Reference Comparison_Operator [ALL | SOME] ARRAY [Array_Parameters]]
[ORDER_BY_Clause]
Parameters
-
Select_List
-
Specifies the list of column aliases (properties) making up the table (rowset) that is returned as a result of the query.
-
* (asterisk)
-
Specifies all columns. This option is valid only when the FROM_Clause parameter references a predefined view or a temporary view.
-
FROM_Clause
-
Specifies the files on which to perform the search. For details about this parameter, see FROM Clause.
-
Column_Reference
-
Specifies the column name (alias). Its data type must be compatible with the format of the specified Array_Parameters parameter. A column reference can have multiple values, such as in a vector property or file attribute bitmask.
-
Comparison_Operator
-
Specifies the arithmetic operator to use to compare the Array_Parameters parameter.
Comparison_Operator can be any of the following:
- Equals (=) and not equals (!=).
- Greater than (>) and greater than or equals (>=).
- Less than (<) and less than or equals (<=).
-
ALL | SOME
-
Specifies the ways to quantify the Array_Parameters parameter. You can use either the ALL or SOME quantifier. If you specify ALL, each parameter on the left side of the expression is tested by using each parameter on the right side. If you specify SOME, at least one parameter on the left side is tested by using at least one parameter of the right side.
For example, the following test fails because parameter 1 on the left side is less than parameter 2 on the right side.
[1,2,3] > ALL ARRAY [1,2]
The following test passes because parameter 2 on the left side is greater than parameter 2 on the right side (and parameter 3 on the left side is greater than parameters 1 and 2 on the right side, but one passed test is sufficient).
[1,2,3] > SOME ARRAY [2,1]
If the ALL or SOME quantifier is absent, each parameter in the vector value on the left side of the operator is compared to its right-side counterpart at the same ordinal position. The test begins with the leftmost parameters and progresses left to right. A test passes if all the individual tests pass. For example, if vectors A[a₁, a₂, a₃] and B[b₁, b₂, b₃] are used, then
A > B
passes if and only if a1 > b1, a2 > b2, and a3 > b3.
If the first m parameters of the vector value on the right match the first m parameters on the right side of the comparison operator, then comparisons actually begin with the (m+1)th parameters where the values on the two sides differ. If all parameters match, then comparison is determined by cardinality, and the one with the higher cardinality is considered greater. The following vector tests all pass.
ARRAY [2,3,4] > ARRAY [1,2] ARRAY [2,3,4] > ARRAY [1,2,3] ARRAY [2,3,4] > ARRAY [1,2,3,4] ARRAY [2,3,4] > ARRAY [1,2,5] ARRAY [2,3,4] > ARRAY [2,3,3] ARRAY [2,3,4] > ARRAY [2,3] ARRAY [2,3,4] < ARRAY [2,3,4,5] ARRAY [2,3,4]!= ARRAY [2,3,4,5]
-
Array_Parameters
-
Specifies the parameters in the array. You must include the square brackets when you specify the array parameters.
It is legal to have an empty array. For example, you can use:
SELECT search FROM SCOPE() WHERE bar = ARRAY[]
-
ORDER_BY_Clause
-
Specifies the ordering of the resulting rowset. This clause is optional. For details about this parameter, see ORDER BY Clause.
Examples
The following example finds all the compressed files with the archive bit set to ON.
... WHERE attrib = ARRAY [0X820]
The following example finds the files with the archive bit set to ON or the compressed bit set to ON.
... WHERE attrib = SOME ARRAY [0X820]
The following example finds ActiveX documents with a vectorprop property value of [10,15,20].
... WHERE vectorprop = ARRAY [10, 15, 20]
The following example finds ActiveX documents where at least one vectorprop property value is 15.
... WHERE vectorprop = SOME ARRAY [15]
The following example finds files that must be printed by printers named HP3 or HP4.
... WHERE printerprop = SOME ARRAY ['HP4' , 'HP3']
Related topics