Class: Woods::Retriever::RetrievalResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/woods/retriever.rb

Overview

The result of a retrieval operation.

When the caller passed types: to #retrieve, type_rank_context is a Hash keyed by requested type name with one entry per type:

{
  "controller" => {
    source: :in_top_k,            # see enum below
    top_of_type_global_rank: 3,   # 1-based rank in unfiltered ranked, or nil
    global_k: 20,                 # size of the unfiltered ranked list
    total_of_type: 183            # total units of that type in the index
  }
}

:source tells the caller which bucket the type landed in without forcing them to infer it from nil ranks:

:in_top_k              — type present in the unfiltered ranked list;
                         strong match.
:within_type_fallback  — type NOT in the unfiltered ranked list, but
                         the fallback vector search returned
                         candidates of this type. Weak match.
:outside_top_k         — type NOT in the unfiltered ranked list, has
                         units in the index, but the fallback did
                         not run (other requested types filled the
                         result). No results of this type.
:absent                — type has zero units in the index.

Nil for unfiltered queries.

Instance Attribute Summary collapse

Instance Attribute Details

#budgetObject

Returns the value of attribute budget

Returns:

  • (Object)

    the current value of budget



85
86
87
# File 'lib/woods/retriever.rb', line 85

def budget
  @budget
end

#classificationObject

Returns the value of attribute classification

Returns:

  • (Object)

    the current value of classification



85
86
87
# File 'lib/woods/retriever.rb', line 85

def classification
  @classification
end

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



85
86
87
# File 'lib/woods/retriever.rb', line 85

def context
  @context
end

#sourcesObject

Returns the value of attribute sources

Returns:

  • (Object)

    the current value of sources



85
86
87
# File 'lib/woods/retriever.rb', line 85

def sources
  @sources
end

#strategyObject

Returns the value of attribute strategy

Returns:

  • (Object)

    the current value of strategy



85
86
87
# File 'lib/woods/retriever.rb', line 85

def strategy
  @strategy
end

#tokens_usedObject

Returns the value of attribute tokens_used

Returns:

  • (Object)

    the current value of tokens_used



85
86
87
# File 'lib/woods/retriever.rb', line 85

def tokens_used
  @tokens_used
end

#traceObject

Returns the value of attribute trace

Returns:

  • (Object)

    the current value of trace



85
86
87
# File 'lib/woods/retriever.rb', line 85

def trace
  @trace
end

#type_rank_contextObject

Returns the value of attribute type_rank_context

Returns:

  • (Object)

    the current value of type_rank_context



85
86
87
# File 'lib/woods/retriever.rb', line 85

def type_rank_context
  @type_rank_context
end