Milvex.QueryResult (milvex v0.10.2)

Copy Markdown

Parser for Milvus query results.

Converts the columnar FieldData format from Milvus QueryResults into row-oriented Elixir maps for easy consumption.

Examples

# Parse from proto
{:ok, result} = QueryResult.from_proto(query_results)

# Access results
result.rows             # List of row maps
result.collection_name  # Collection queried
result.output_fields    # Field names returned

# Each row is a map
row = hd(result.rows)
row.id     # Primary key value
row.title  # Field value

Summary

Functions

Checks if the result is empty.

Parses a QueryResults proto into a QueryResult struct.

Gets all values for a specific field across all rows.

Gets a specific row by index (0-based).

Returns the number of rows in the result.

Types

t()

@type t() :: %Milvex.QueryResult{
  collection_name: String.t(),
  output_fields: [String.t()],
  primary_field_name: String.t() | nil,
  rows: [map()]
}

Functions

empty?(query_result)

@spec empty?(t()) :: boolean()

Checks if the result is empty.

from_proto(proto)

@spec from_proto(Milvex.Milvus.Proto.Milvus.QueryResults.t()) :: t()

Parses a QueryResults proto into a QueryResult struct.

Converts columnar FieldData to row-oriented maps.

Parameters

  • proto - The QueryResults protobuf struct

get_column(query_result, field_name)

@spec get_column(t(), String.t() | atom()) :: [term()]

Gets all values for a specific field across all rows.

get_row(query_result, index)

@spec get_row(t(), non_neg_integer()) :: map() | nil

Gets a specific row by index (0-based).

num_rows(query_result)

@spec num_rows(t()) :: non_neg_integer()

Returns the number of rows in the result.