# SearchExpressionType

> Type used to characterize an expression. An expression might have multiple types. For example a Set is also an iterable. A keyword is also considered a string value. SearchExpressionType can be used with SearchExpressionEvaluatorAttribute to describe the parameter list of an evaluator.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEditor.Search](/engine/6000.5/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

```csharp
[Flags]
public enum SearchExpressionType
```

## Examples

```csharp
[SearchExpressionEvaluator(SearchExpressionType.Iterable | SearchExpressionType.Variadic)]
[SearchExpressionEvaluatorSignatureOverload(SearchExpressionType.Number, SearchExpressionType.Iterable | SearchExpressionType.Variadic)]
[Description("Extract and returns the X first results for each expression.")]
public static IEnumerable<SearchItem> TakeXFirst(SearchExpressionContext c)
{
    var argIndex = 0;
    var takeNumber = 1;
    if (c.args[0].types.HasFlag(SearchExpressionType.Number))
    {
        ++argIndex;
        takeNumber = Math.Max((int)(c.args[0].GetNumberValue(takeNumber)), 0);
    }

    for ( ; argIndex < c.args.Length; ++argIndex)
    {
        var iterable = c.args[argIndex].Execute(c);
        var taken = 0;
        foreach (var item in iterable)
        {
            if (item == null)
                yield return null;
            else
            {
                yield return item;
                ++taken;
                if (taken == takeNumber)
                {
                    c.Break();
                    break;
                }
            }
        }
    }
}
```

## Fields

| Value                                                                                                     | Description                                                                                                                                                                                                                                                                                                         |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AnyExpression](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/anyexpression.md) | Denote any expression of any type (Literal, Iterable or Selector).                                                                                                                                                                                                                                                  |
| [AnyValue](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/anyvalue.md)           | Denote an expression with a value type: either Literal or Iterable.                                                                                                                                                                                                                                                 |
| [Boolean](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/boolean.md)             | Denote a Literal expression of a boolean value.                                                                                                                                                                                                                                                                     |
| [Expandable](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/expandable.md)       | Denotes an expression using the ... operator to tell it can be expanded.                                                                                                                                                                                                                                            |
| [Function](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/function.md)           | Denotes an expression of an evaluator function. For example: count\{}.                                                                                                                                                                                                                                              |
| [Group](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/group.md)                 | Denote an expression of a group of items. Groups are generated by the groupBy\{} evaluator.                                                                                                                                                                                                                         |
| [Iterable](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/iterable.md)           | Denote an expression that can iterated to yield [SearchItem](/engine/6000.5/script-reference/unityeditor/search/searchitem.md). Set: \[1, 2, 3], Query String:  t:shader and evaluator: count\{} are all example of iterables.                                                                                      |
| [Keyword](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/keyword.md)             | Denote an expression yielding a [SearchExpressionKeyword](/engine/6000.5/script-reference/unityeditor/search/searchexpressionkeyword.md).                                                                                                                                                                           |
| [Literal](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/literal.md)             | Denote an expression built from a literal values: boolean, number, text or keyword. For example in the set expression \[1,"hello",true] all set values are literals.                                                                                                                                                |
| [Nil](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/nil.md)                     | Denote an invalid Expression.                                                                                                                                                                                                                                                                                       |
| [Number](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/number.md)               | Denote a Literal expression of a numerical value.                                                                                                                                                                                                                                                                   |
| [Optional](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/optional.md)           | Used in [SearchExpressionEvaluatorAttribute](/engine/6000.5/script-reference/unityeditor/search/searchexpressionevaluatorattribute.md) to specify a aprameter to be Optional.                                                                                                                                       |
| [QueryString](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/querystring.md)     | Denote an expression representing a query string. For example: t:shader.                                                                                                                                                                                                                                            |
| [Selector](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/selector.md)           | Denote an expression representing a selector. All selector starts with @. For example @size in expression: select\{t:material, @size}.                                                                                                                                                                              |
| [Set](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/set.md)                     | Denote an iterable expression of a group of generally literal values. For example \[1, 2, 3] or \[material, shader, texture2d].                                                                                                                                                                                     |
| [Text](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/text.md)                   | Denote an expression representing a textual (string) value.                                                                                                                                                                                                                                                         |
| [Variadic](/engine/6000.5/script-reference/unityeditor/search/searchexpressiontype/variadic.md)           | Used in [SearchExpressionEvaluatorAttribute](/engine/6000.5/script-reference/unityeditor/search/searchexpressionevaluatorattribute.md) to specify that a parameter can be used multiples times. For example count\{Iterable1, Iterable2,... IterableN} can be executed with any number of iterables are parameters. |
