WeaviateEx.Query.BM25Operator (WeaviateEx v0.7.4)

View Source

BM25 operator configuration for keyword search.

Controls how search tokens are combined in BM25 queries.

Examples

# OR with minimum match - at least 2 tokens must match
operator = BM25Operator.or_(2)

# AND - all tokens must match
operator = BM25Operator.and_()

# Use in query
Query.get("Article")
|> Query.bm25("machine learning AI", operator: operator)

Summary

Functions

Create an AND operator.

Create an OR operator with minimum token match requirement.

Convert BM25 operator configuration to GraphQL format.

Types

t()

@type t() :: %WeaviateEx.Query.BM25Operator{
  minimum_should_match: non_neg_integer() | nil,
  type: :and | :or
}

Functions

and_()

@spec and_() :: t()

Create an AND operator.

All tokens must match for a document to be returned.

Examples

BM25Operator.and_()

or_(minimum_match)

@spec or_(non_neg_integer()) :: t()

Create an OR operator with minimum token match requirement.

At least minimum_match tokens must match for a document to be returned.

Examples

BM25Operator.or_(2)  # At least 2 tokens must match

to_graphql(bm25_operator)

@spec to_graphql(t()) :: String.t()

Convert BM25 operator configuration to GraphQL format.

Examples

operator = BM25Operator.or_(2)
BM25Operator.to_graphql(operator)