Conditional Expressions

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.

 

You can add if-then-else conditional logic to control the substitution of variables and parameters. The syntax is similar to conditional expressions in .htx files, but not exactly the same.

The following rules apply to conditional expressions in .idq files:

  • Lines in your .idq file must start with the variable name you're trying to set.
  • Only one line can set a particular variable in an .idq file.
  • Make sure variable references and statements are surrounded by percent signs (%).

The following example shows how to set the CiRestriction variable:

CiRestriction=%if Restriction ISEMPTY%Index Server Help%else%%Restriction%%endif%

This example stops users from running empty searches.

The following list shows the possible operators in If statements for .idq files:

EQ

if value1 equals value2

NE

if value1 does not equal value2

LT

if value1 is less than value2

LE

if value1 is less than or equal to value2

GT

if value1 is greater than value2

GE

if value1 is greater than or equal to value2

CONTAINS

if any part of value1 contains the string value2

ISEMPTY

TRUE if value1 is a Null string. This is a unary postfix operator.