# Base definitions for processors

search_api.default_processor_configuration:
  type: mapping
  label: 'Default processor configuration'
  mapping:
    weights:
      type: sequence
      label: 'The processor''s weights for the different processing stages'
      orderby: key
      sequence:
        type: integer
        label: 'The processor''s weight for this stage'

search_api.fields_processor_configuration:
  type: search_api.default_processor_configuration
  label: 'Fields processor configuration'
  mapping:
    all_fields:
      type: boolean
      label: 'Enabled for all supported fields'
    fields:
      type: sequence
      label: 'The selected fields'
      orderby: value
      sequence:
        type: string
        label: 'Selected field'

# Default for any processor without specific configuration
plugin.plugin_configuration.search_api_processor.*:
  type: search_api.default_processor_configuration

# Definitions for individual processors

plugin.plugin_configuration.search_api_processor.hierarchy:
  type: search_api.default_processor_configuration
  label: 'Hierarchy processor configuration'
  mapping:
    fields:
      type: sequence
      label: 'Fields for which to add the hierarchy, mapped to their hierarchical nested property'
      orderby: key
      sequence:
        type: string
        label: 'Field ID'

plugin.plugin_configuration.search_api_processor.highlight:
  type: search_api.default_processor_configuration
  label: 'Highlight processor configuration'
  mapping:
    prefix:
      type: string
      label: 'Text/HTML that will be prepended to all occurrences of search keywords in highlighted text'
    suffix:
      type: string
      label: 'Text/HTML that will be appended to all occurrences of search keywords in highlighted text'
    excerpt:
      type: boolean
      label: 'When enabled, an excerpt will be created for searches with keywords, containing all occurrences of keywords in a fulltext field.'
    excerpt_always:
      type: boolean
      label: 'When enabled, an excerpt will be created even with an empty query string.'
    excerpt_length:
      type: integer
      label: 'The requested length of the excerpt, in characters'
    exclude_fields:
      type: sequence
      label: 'Fields excluded from excerpt'
      orderby: value
      sequence:
        type: string
        label: 'An excluded field''s ID'
    highlight:
      type: string
      label: 'Defines whether returned fields should be highlighted (always/if returned/never).'
    highlight_partial:
      type: boolean
      label: 'Whether matches in parts of words should be highlighted'

plugin.plugin_configuration.search_api_processor.html_filter:
  type: search_api.fields_processor_configuration
  label: 'HTML filter processor configuration'
  mapping:
    title:
      type: boolean
      label: 'Title'
    alt:
      type: boolean
      label: 'Alt'
    tags:
      type: sequence
      label: 'Tag boosts'
      orderby: key
      sequence:
        type: float
        label: Boost

plugin.plugin_configuration.search_api_processor.ignorecase:
  type: search_api.fields_processor_configuration
  label: 'Ignore case processor configuration'

plugin.plugin_configuration.search_api_processor.ignore_character:
  type: search_api.fields_processor_configuration
  label: 'Ignore Character processor configuration'
  mapping:
    ignorable:
      type: string
      label: 'Regular expression for characters to ignore'
    ignorable_classes:
      type: sequence
      label: 'Character categories to ignore'
      orderby: value
      sequence:
        type: string
        label: 'Character set'

plugin.plugin_configuration.search_api_processor.number_field_boost:
  type: search_api.default_processor_configuration
  label: 'Number field-based boosting processor configuration'
  mapping:
    boosts:
      type: sequence
      label: 'Boost settings'
      orderby: key
      sequence:
        type: mapping
        label: 'Field boost settings'
        mapping:
          boost_factor:
            type: float
            label: 'The boost factor for this field'
          aggregation:
            type: string
            label: 'The aggregation function for multi-valued fields'

plugin.plugin_configuration.search_api_processor.stemmer:
  type: search_api.fields_processor_configuration
  label: 'Stemmer processor configuration'
  mapping:
    exceptions:
      type: sequence
      label: 'Stemming exceptions'
      orderby: key
      sequence:
        type: string
        label: Exception

plugin.plugin_configuration.search_api_processor.role_filter:
  type: search_api.default_processor_configuration
  label: 'Role filter processor configuration'
  mapping:
    default:
      type: boolean
      label: 'Default'
    roles:
      type: sequence
      label: 'The selected roles'
      orderby: value
      sequence:
        type: string
        label: 'The role name'

plugin.plugin_configuration.search_api_processor.stopwords:
  type: search_api.fields_processor_configuration
  label: 'Stopwords processor configuration'
  mapping:
    stopwords:
      type: sequence
      label: 'Entered stopwords'
      orderby: value
      sequence:
        type: string
        label: Stopword

plugin.plugin_configuration.search_api_processor.tokenizer:
  type: search_api.fields_processor_configuration
  label: 'Tokenizer processor configuration'
  mapping:
    spaces:
      type: string
      label: 'Regular expression for spaces'
    ignored:
      type: string
      label: 'Regular expression for ignored characters'
    overlap_cjk:
      type: integer
      label: 'Defines if simple CJK handling should be enabled.'
    minimum_word_size:
      type: string
      label: 'Defines the minimum word size'

plugin.plugin_configuration.search_api_processor.transliteration:
  type: search_api.fields_processor_configuration
  label: 'Transliteration processor configuration'

plugin.plugin_configuration.search_api_processor.type_boost:
  type: search_api.default_processor_configuration
  label: 'Type-specific boosting processor configuration'
  mapping:
    boosts:
      type: sequence
      label: 'Boost settings'
      orderby: key
      sequence:
        type: mapping
        label: 'Datasource boost settings'
        mapping:
          datasource_boost:
            type: float
            label: 'Base boost for the datasource'
          bundle_boosts:
            type: sequence
            label: 'Bundle-specific boosts'
            orderby: key
            sequence:
              type: float
              label: 'The boost value for this bundle'

# Definitions for property configuration

search_api.property_configuration.*:
  type: mapping
  label: 'Default field configuration'
  mapping: {}

search_api.property_configuration.aggregated_field:
  type: mapping
  label: 'Aggregated field configuration'
  mapping:
    type:
      type: string
      label: 'The type of the aggregation'
    separator:
      type: string
      label: 'The separator used if the "Concatenation" type is selected'
    fields:
      type: sequence
      label: 'The properties to be aggregated'
      orderby: value
      sequence:
        type: string
        label: 'A property that should be part of the aggregation'

search_api.property_configuration.rendered_item:
  type: mapping
  label: 'Rendered item processor configuration'
  mapping:
    roles:
      type: sequence
      label: 'The selected roles'
      orderby: value
      sequence:
        type: string
        label: 'The user roles which will be active when the entity is rendered'
    view_mode:
      type: sequence
      label: 'The selected view modes for each datasource, by bundle'
      orderby: key
      sequence:
        type: sequence
        label: 'The selected view modes for the datasource, by bundle'
        orderby: key
        sequence:
          type: string
          label: 'The view mode used to render the entity for the specified bundle'

search_api.property_configuration.search_api_url:
  type: mapping
  label: 'Add URL configuration'
  mapping:
    absolute:
      type: boolean
      label: 'Whether to generate an absolute URL'

search_api.property_configuration.custom_value:
  type: mapping
  label: Custom value
  mapping:
    value:
      type: string
      label: 'The field value'
