Class: Kreuzberg::Result::ElementStruct

Inherits:
Struct
  • Object
show all
Defined in:
lib/kreuzberg/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#element_idString (readonly)

Returns Unique element identifier.

Returns:

  • (String)

    Unique element identifier



231
232
233
234
235
236
237
238
239
240
# File 'lib/kreuzberg/result.rb', line 231

ElementStruct = Struct.new(:element_id, :element_type, :text, :metadata) do
  def to_h
    {
      element_id: element_id,
      element_type: element_type,
      text: text,
      metadata: &.to_h
    }
  end
end

#element_typeString (readonly)

Returns Semantic type of the element.

Returns:

  • (String)

    Semantic type of the element



231
232
233
234
235
236
237
238
239
240
# File 'lib/kreuzberg/result.rb', line 231

ElementStruct = Struct.new(:element_id, :element_type, :text, :metadata) do
  def to_h
    {
      element_id: element_id,
      element_type: element_type,
      text: text,
      metadata: &.to_h
    }
  end
end

#metadataElementMetadataStruct (readonly)

Returns Metadata about the element.

Returns:



231
232
233
234
235
236
237
238
239
240
# File 'lib/kreuzberg/result.rb', line 231

ElementStruct = Struct.new(:element_id, :element_type, :text, :metadata) do
  def to_h
    {
      element_id: element_id,
      element_type: element_type,
      text: text,
      metadata: &.to_h
    }
  end
end

#textString (readonly)

Returns Text content of the element.

Returns:

  • (String)

    Text content of the element



231
232
233
234
235
236
237
238
239
240
# File 'lib/kreuzberg/result.rb', line 231

ElementStruct = Struct.new(:element_id, :element_type, :text, :metadata) do
  def to_h
    {
      element_id: element_id,
      element_type: element_type,
      text: text,
      metadata: &.to_h
    }
  end
end

Instance Method Details

#to_hObject



232
233
234
235
236
237
238
239
# File 'lib/kreuzberg/result.rb', line 232

def to_h
  {
    element_id: element_id,
    element_type: element_type,
    text: text,
    metadata: &.to_h
  }
end