# Fields with a Nonzero Value for Bitwise AND

You can use the following field specifiers (case sensitive) to return documents with fields whose value result in a nonzero value when a bitwise `AND` operation is carried out against a specified value.

## BITAND

The `BITAND` field specifier (case sensitive) allows you to find documents with a field whose integer value does not result in 0 when a bitwise `AND` operation is carried out between this value and an integer value that you specify.

    FieldText=BITAND{yourInteger}:yourBitFields

where:

`yourInteger` | is an integer. A document returns only if one of `yourBitFields` contains a value that results in a nonzero value when a bitwise AND operation is carried out between this value and the specified integer.
`yourBitFields` | is one or more fields. A document returns only if it contains one of these fields, and if this field contains an integer that results in a nonzero value when a bitwise AND operation is carried out between it and `yourInteger`. If you want to specify multiple fields, separate them with colons (there must be no space before or after a colon).

Example:

    FieldText=BITAND{128}:BitField

The binary representation of the integer value 128 is compared with the binary representations of the integer values that `BitField` fields in the IDOL Content component contain. Only documents whose `BitField` values result in a nonzero value when they are compared to the binary representation of 128 return.

For example, if the `BitField` of a document contains the integer value `129`, it returns, but a document whose `BitField` contains the value `127` does not return.

The following tables show the field value comparison.

Integer | Binary |
--- | --- | ---
128 | 1000 0000 |
129 | 1000 0001 |
| 1000 0000 | this evaluates to `True`

Integer | Binary |
--- | --- | ---
128 | 1000 0000 |
127 | 0111 1111 |
| 0000 0000 | this evaluates to `False`

## BITANDHEX

The `BITANDHEX` field specifier (case sensitive) allows you to find documents with a field whose hexadecimal string value does not result in zero when a bitwise `AND` operation is carried out between this value and a hexadecimal string that you specify.

    FieldText=BITANDHEX{yourHexString}:yourBitFields

where:

`yourHexString` | is a hexadecimal string. A document returns only if one of `yourBitFields` contains a value that results in a nonzero value when a bitwise AND operation is carried out between this value and the specified hexadecimal string.
`yourBitFields` | is one or more fields. A document returns only if it contains one of these fields, and if this field contains a hexadecimal string that results in a nonzero value when a bitwise AND operation is carried out between it and `yourHexString`. To specify multiple fields, separate them with colons (there must be no space before or after a colon).

Example:

    FieldText=BITANDHEX{7F}:BitField

The binary representation of the hexadecimal value 7F is compared with the binary representations of the hexadecimal values that `BitField` fields in IDOL Server contain. Only documents whose `BitField` values result in a nonzero value when they are compared to the binary representation of 7F return.

For example, if the `BitField`of a document contains the hexadecimal value `C0`, it returns, but a document whose `BitField` contains the hexadecimal value 80 does not return.

The following tables show the field value comparison.

Hex | Binary |
--- | --- | ---
7F | 0111 1111 |
C0 | 1100 0000 |
| 0100 0000 | this evaluates to `True`

Hex | Binary |
--- | --- | ---
7F | 0111 1111 |
80 | 1000 0000 |
| 0000 0000 | this evaluates to `False`

## BITANDOFFHEX

The `BITANDOFFHEX` field specifier (case sensitive) allows you to find documents with a field whose hexadecimal string value does not result in zero when a bitwise `AND` operation is carried out between this value and an offset hexadecimal string you specify.

    FieldText=BITANDOFFHEX{NN,yourHexString}:yourBitFields

where:

`NN` | is the number of 16-bit chunks by which the value in `yourHexString` and in `yourBitFields` is shifted before the bitwise `AND` operation is carried out (this allows you to store sparse bit masks more efficiently).
`yourHexString` | is a hexadecimal string. A document returns only if one of `yourBitFields` contains a value that results in a nonzero value when a bitwise `AND` operation is carried out between this value and the specified hexadecimal string.
`yourBitFields` | is one or more fields. A document returns only if it contains one of these fields, and if this field contains a hexadecimal string that results in a nonzero value when a bitwise `AND` operation is carried out between it and `yourHexString`. If you want to specify multiple fields, separate them with colons (there must be no space before or after a colon).

Example:

    FieldText=BITANDOFFHEX{01,0a001}:BitOffField

The binary representation of the hexadecimal value `01,0a001` is compared with the binary representations of the hexadecimal values that `BitOffField` fields in the IDOL Content component contain. Only documents whose `BitOffField` values result in a nonzero value when they are compared to the binary representation of `01,0a001` (after they have been shifted left by one 16-bit chunk) return.

For example, if the `BitOffField` contains the value `1,bc01`, the document returns, but a document whose `BitOffField` contains the value `0,5ffeffff` does not return.

The following tables show the field value comparison.

nn,hexstring | Hex | Binary |
--- | --- | --- | ---
01,0a001 | A0010000 | 1010 0000 0000 0001 0000 0000 0000 0000 |
1,bc01 | BC010000 | 1011 1100 0000 0001 0000 0000 0000 0000 |
|  | 1010 0000 0000 0001 0000 0000 0000 0000 | this evaluates to `True`

nn,hexstring | Hex | Binary |
--- | --- | --- | ---
01,0a001 | A0010000 | 1010 0000 0000 0001 0000 0000 0000 0000 |
0,5ffeffff | 5FFEFFFF | 0101 1111 1111 1110 1111 1111 1111 1111 |
|  | 0000 0000 0000 0000 0000 0000 0000 0000 | this evaluates to `False`

_FT_HTML5_bannerTitle.htm