Class: AWSCDK::Kendra::CfnIndex::RelevanceProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
kendra/cfn_index.rb

Overview

Provides information for tuning the relevance of a field in a search.

When a query includes terms that match the field, the results are given a boost in the response based on these tuning parameters.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(duration: nil, freshness: nil, importance: nil, rank_order: nil, value_importance_items: nil) ⇒ RelevanceProperty

Returns a new instance of RelevanceProperty.

Parameters:

  • duration (String, nil) (defaults to: nil)

    Specifies the time period that the boost applies to.

  • freshness (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates that this field determines how "fresh" a document is.

  • importance (Numeric, nil) (defaults to: nil)

    The relative importance of the field in the search.

  • rank_order (String, nil) (defaults to: nil)

    Determines how values should be interpreted.

  • value_importance_items (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Kendra::CfnIndex::ValueImportanceItemProperty>, nil) (defaults to: nil)

    An array of key-value pairs for different boosts when they appear in the search result list.



932
933
934
935
936
937
938
939
940
941
942
943
# File 'kendra/cfn_index.rb', line 932

def initialize(duration: nil, freshness: nil, importance: nil, rank_order: nil, value_importance_items: nil)
  @duration = duration
  Jsii::Type.check_type(@duration, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "duration") unless @duration.nil?
  @freshness = freshness
  Jsii::Type.check_type(@freshness, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "freshness") unless @freshness.nil?
  @importance = importance
  Jsii::Type.check_type(@importance, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "importance") unless @importance.nil?
  @rank_order = rank_order
  Jsii::Type.check_type(@rank_order, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rankOrder") unless @rank_order.nil?
  @value_importance_items = value_importance_items
  Jsii::Type.check_type(@value_importance_items, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa2VuZHJhLkNmbkluZGV4LlZhbHVlSW1wb3J0YW5jZUl0ZW1Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "valueImportanceItems") unless @value_importance_items.nil?
end

Instance Attribute Details

#durationString? (readonly)

Specifies the time period that the boost applies to.

For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.

Only applies to DATE fields.



953
954
955
# File 'kendra/cfn_index.rb', line 953

def duration
  @duration
end

#freshnessBoolean, ... (readonly)

Indicates that this field determines how "fresh" a document is.

For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to DATE fields.



960
961
962
# File 'kendra/cfn_index.rb', line 960

def freshness
  @freshness
end

#importanceNumeric? (readonly)

The relative importance of the field in the search.

Larger numbers provide more of a boost than smaller numbers.



967
968
969
# File 'kendra/cfn_index.rb', line 967

def importance
  @importance
end

#rank_orderString? (readonly)

Determines how values should be interpreted.

When the RankOrder field is ASCENDING , higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.

When the RankOrder field is DESCENDING , lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.

Only applies to LONG fields.



978
979
980
# File 'kendra/cfn_index.rb', line 978

def rank_order
  @rank_order
end

#value_importance_itemsAWSCDK::IResolvable, ... (readonly)

An array of key-value pairs for different boosts when they appear in the search result list.

For example, if you want to boost query terms that match the "department" field in the result, query terms that match this field are boosted in the result. You can add entries from the department field to boost documents with those values higher.

For example, you can add entries to the map with names of departments. If you add "HR", 5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document.



987
988
989
# File 'kendra/cfn_index.rb', line 987

def value_importance_items
  @value_importance_items
end

Class Method Details

.jsii_propertiesObject



989
990
991
992
993
994
995
996
997
# File 'kendra/cfn_index.rb', line 989

def self.jsii_properties
  {
    :duration => "duration",
    :freshness => "freshness",
    :importance => "importance",
    :rank_order => "rankOrder",
    :value_importance_items => "valueImportanceItems",
  }
end

Instance Method Details

#to_jsiiObject



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
# File 'kendra/cfn_index.rb', line 999

def to_jsii
  result = {}
  result.merge!({
    "duration" => @duration,
    "freshness" => @freshness,
    "importance" => @importance,
    "rankOrder" => @rank_order,
    "valueImportanceItems" => @value_importance_items,
  })
  result.compact
end