Setting Query Options in C# OJAI

There are two categories of options you can set in your C# OJAI application. This topic describes both and shows you how to set each.

Setting Query Options Using a C# OJAI Method Call

Option Name Description

Enables or disables availability of the query plan for retrieval

Value: true|false

Default: false


Query timeout in milliseconds

Maximum allowed value is 2147483647.

Default: None; no timeout

To set any of these query options, you must pass the option as the second parameter in the DocumentStore.Find method.

The following code snippet sets the query timeout to 3000 milliseconds:

var queryResult = store.Find(query, new QueryOptions() { Timeout = 3000 });

var queryResult = store.Find(query, new QueryOptions(3000));

Setting Query Options in C# Using OJAI Query Syntax

OJAI Query Options describes query options that are available in all OJAI clients. To use these options in C# OJAI, you must construct your query in JSON format and use the $options keyword. See OJAI Query Syntax for details about the syntax, including an example.