Version: 2022.2
public Search.QueryFilterOperator AddOperator (string op);

参数

op The operator identifier.

返回

QueryFilterOperator The added, or existing, QueryFilterOperator.

描述

Add a custom filter operator specific to the filter.

Custom operators defined on a filter take precedence over operators defined globally on the QueryEngine. This is useful if you wish to have a custom operator only for a specific filter, or if you wish to override the default behavior of a built-in operator for a specific filter. If the operator already exists, the existing operator is returned.

// Override global operators with specific operator handlers for this filter
filter.AddOperator("=").AddHandler((Vector2 ev, Vector2 fv) => ev == fv);
filter.AddOperator("!=").AddHandler((Vector2 ev, Vector2 fv) => ev != fv);

See IQueryEngineFilter for a complete example.