Skip to main content

Combine Search LC

Uncontrolled node

Overview

The Combine Search LC (Linear Combination) node merges search results from multiple sources into a single ranked list using weighted linear combination. It is particularly useful when you want to aggregate results from different search methods (e.g., vector search, text search, or external APIs) and create a unified ranking.

This node performs min-max normalization on scores from each input list, then combines them using configurable weights. Items are matched across lists using a specified key field (default: intellectible_id).

How it works

  1. Normalization: Each input list's scores are normalized to a 0-1 scale using min-max normalization
  2. Weighting: Normalized scores are multiplied by their respective weights
  3. Aggregation: Scores for matching items are summed across all lists
  4. Ranking: Results are sorted by the final combined score in descending order

Inputs

InputTypeDescriptionDefault
WeightsTextComma-separated list of weights for each result set (e.g., "0.6,0.4"). If fewer weights than results are provided, the last weight is repeated. If no weights provided, equal weighting is used."1,1"
Results 0-9DataSearch result arrays to combine. The number of active inputs is controlled by the Results Count property. Each result should be an array of objects containing the match field and a score property.-
Results CountNumberNumber of result lists to combine (2-10). Dynamically adjusts the available result inputs.2
Match FieldTextThe field name used to identify matching items across different result lists (e.g., "intellectible_id", "id", "document_id")."intellectible_id"

Outputs

OutputTypeDescription
ResultDataCombined and re-ranked list of items. Each item includes the original fields plus combinedScore and individual score0, score1, etc. fields showing the original scores from each input list.

Runtime Behavior and Defaults

  • Uncontrolled Node: This node runs automatically when its inputs change. It does not require an event trigger.
  • Dynamic Inputs: The node dynamically creates result inputs (results0, results1, etc.) based on the resultsCount setting. When you increase the count, new inputs appear; when you decrease it, excess inputs are removed along with any connections.
  • Score Normalization: Each input list is normalized independently using min-max scaling: (score - min) / (max - min). If all scores in a list are identical, a default range of 1 is used to avoid division by zero.
  • Weight Normalization: Weights are automatically normalized to sum to 1. If you provide weights "2,1", they become "0.667,0.333".
  • Missing Items: If an item appears in some lists but not others, it receives a normalized score of 0 for the missing lists (no contribution to the combined score).

Example Usage

Basic Usage with Two Search Results

Connect two search nodes (e.g., Vector Search and Text Search) to results0 and results1. Set weights to "0.7,0.3" to prioritize vector search results while still considering text search.

Aggregating Multiple Sources

Set Results Count to 4 and connect:

  • results0: Vector search results (weight: 0.5)
  • results1: Full-text search results (weight: 0.3)
  • results2: Keyword match results (weight: 0.15)
  • results3: External API results (weight: 0.05)

The node will output a single list ranked by the weighted combination of all four sources.

Custom Match Fields

If your search results use different ID fields (e.g., one returns id and another returns document_id), set Match Field to the common field name that exists in all result objects (e.g., "uuid" or "record_id").

Score Preservation

The output includes both the combined score (combinedScore) and individual scores from each source (score0, score1, etc.) as null if the item wasn't found in that particular list. This allows you to see which sources contributed to each result.