Blyx

Shrike

Rank fusion framework · 0.1.0

Combine lexical and semantic search results by rank, then walk the merged list in a deterministic order.

Merge two help-center searches

A literal-word search and a paraphrase search return different article IDs. The example prints the first three fused results. Article 21 wins because both rankers put it near the top.

Download the standalone example

Extract the archive and run shrike-demo.exe on Windows or ./shrike-demo on Linux and macOS. Each archive includes the Blyx source and tests.

Build from source

With Blyx 0.2.1, Rust and a host linker installed, run these commands to edit and rebuild the example.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-shrike.git
cd blyx-shrike
blyxc native-run project.blyx

Why this framework exists

A keyword ranker and an embedding ranker return scores on different scales. Reciprocal rank fusion combines each document’s position in the lists. It gives a developer an inspectable baseline before tuning a score calibration or training a reranker. Cormack, Clarke and Buettcher, Reciprocal Rank Fusion

Install Shrike in your editor

Extension RahulChaube.blyx-shrike · 0.1.0

The extension includes a runnable Blyx example, function completions and the framework source. For the modular project, extract the starter, open its folder and run blyxc native-run main.blyx with the native toolchain installed.

Create an empty .blyx file, type blyx-shrike-demo and accept the completion. Choose Blyx: Run File to run the example.

For an offline installation, choose Extensions: Install from VSIX for Blyx Language first, then for Shrike.

Download the companion Blyx Language VSIX

Install with Conda

Create an environment containing Shrike 0.1.0, its Blyx source and a runnable example. Run the second command with Blyx 0.2.1, Rust and a host linker installed.

conda create -y --prefix ./blyx-env --override-channels -c https://rahulchaube1.github.io/blyx-packages blyx-shrike=0.1.0=0
blyxc native-run ./blyx-env/share/blyx/shrike/main.blyx

To use this package in your application, copy share/blyx/shrike/vendor/shrike from the environment into your project's vendor directory.

Install the full collection with Homebrew or Scoop

Import into a Blyx project

Install Blyx 0.2.1, Rust 1.85 or newer and a host linker. From the directory containing your entry file, clone this tagged release.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-shrike.git vendor/shrike

Save this as main.blyx beside vendor and run blyxc native-run main.blyx.

use vendor::shrike::shrike;

fn main() {
    let lexical = [41, 17, 83];
    let semantic = [17, 83, 99];
    let first = sh_next(lexical, semantic, 60.0, -1.0);
    let second = sh_next(lexical, semantic, 60.0, first);
    println!(first);
    println!(second);
}

Expected output

17
83

API and input requirements

Supply two ranked vectors of nonnegative integer IDs up to 2^53−1 and an offset from 0 to 1,000,000. The first occurrence in each list contributes 1/(offset + one-based position). Missing IDs contribute zero. Equal scores use ascending ID. Start the cursor at −1. Each next-result call can take quadratic time in the combined shortlist length; use this version with small candidate sets.

APIUse
sh_valid_inputs(left, right, offset)Validate every ID and the smoothing offset.
sh_score(left, right, id, offset)Get the fused score of one document. Zero means absent and −1 means invalid input.
sh_next(left, right, offset, previous)Get the next ID after a cursor, or −1 for exhaustion or invalid input. Each ID is returned once.

Develop and contribute

Open the tagged source to read the implementation and examples. Include the smallest reproducible Blyx program, compiler version and expected result when reporting an issue.