Class LookupDef.Builder

java.lang.Object
ai.vectros.types.LookupDef.Builder
Enclosing class:
LookupDef

public static final class LookupDef.Builder extends Object
  • Method Details

    • from

      public LookupDef.Builder from(LookupDef other)
    • fieldName

      public LookupDef.Builder fieldName(Optional<String> fieldName)

      Name of the payload field to index. Supply either this or fieldNames, never both.

    • fieldName

      public LookupDef.Builder fieldName(String fieldName)
    • fieldNames

      public LookupDef.Builder fieldNames(Optional<List<String>> fieldNames)

      Names of the payload fields to index together as a single lookup, so you can match on all of them at once (status AND area). Supply this instead of fieldName; between 2 and 3 fields.

      The order is significant, and re-declaring the same fields in a different order creates a SEPARATE lookup rather than reordering this one — it is indexed independently, costs its own index, and matches only records written after you declare it. Choose the order deliberately: you can match on the first field alone, the first two together, and so on — any leading run of the list — but never on a later field by itself. Declare a separate lookup for that.

      Query it by passing the field names joined with commas as field (field=status,area), plus one value per field you are matching. Supplying fewer values than the lookup declares returns the records grouped by the fields you left unspecified; sortBy then orders records within each group, not across them.

      A lookup over several fields cannot set unique.

    • fieldNames

      public LookupDef.Builder fieldNames(List<String> fieldNames)
    • unique

      public LookupDef.Builder unique(Optional<Boolean> unique)

      If true, enforces that this field's value is unique within your account. Not available on a lookup over several fields.

    • unique

      public LookupDef.Builder unique(Boolean unique)
    • rangeEnabled

      public LookupDef.Builder rangeEnabled(Optional<Boolean> rangeEnabled)

      If true, this field also supports ordered range and prefix lookups (from/to/prefix) in addition to exact-match lookups. Range-enabled fields are billed at the range-index rate. Cannot be set on a sensitive field, because a blind index is not orderable. Not available on a lookup over several fields, which is an exact-match index over its fields — declare the range lookup separately. This setting is locked once the field is created.

    • rangeEnabled

      public LookupDef.Builder rangeEnabled(Boolean rangeEnabled)
    • sortBy

      public LookupDef.Builder sortBy(Optional<String> sortBy)

      For an exact-match lookup, the index sort key: createdAt (the default), lastUpdated, or a declared field on this schema. This setting is locked once the field is created.

    • sortBy

      public LookupDef.Builder sortBy(String sortBy)
    • allowOverflow

      public LookupDef.Builder allowOverflow(Optional<Boolean> allowOverflow)

      Each schema has a fixed budget of fast exact-match lookup indexes. An exact-match lookup beyond that budget is rejected unless you set this flag, which opts the field into a higher-cost secondary index (more storage and transactional writes). Range-enabled lookups do not count against the budget. This flag has no effect on a field that fits within the budget.

    • allowOverflow

      public LookupDef.Builder allowOverflow(Boolean allowOverflow)
    • build

      public LookupDef build()
    • additionalProperty

      public LookupDef.Builder additionalProperty(String key, Object value)
    • additionalProperties

      public LookupDef.Builder additionalProperties(Map<String,Object> additionalProperties)