---
title: scoring | CodeWeaver Docs
description: API reference for codeweaver.server.agent_api.search.scoring
url: "https://docs.knitli.com/api/server/agent_api/search/scoring"
type: static
generatedAt: "2026-04-17T17:21:09.695Z"
---

# scoring
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/server/agent_api/search/scoring.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F&text=scoring)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F&text=scoring)[Share on Bluesky](https://bsky.app/intent/compose?text=scoring%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F&title=scoring)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F&t=scoring)[Share on Email](mailto:?subject=scoring&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F)[Share on WhatsApp](https://wa.me/?text=scoring%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fserver%2Fagent_api%2Fsearch%2Fscoring%2F&text=scoring)
# `codeweaver.server.agent_api.search.scoring`
[Section titled “codeweaver.server.agent_api.search.scoring”](#codeweaverserveragent_apisearchscoring)
Scoring and reranking utilities for search results.

This module handles the scoring pipeline including:

 - Hybrid search score combination (dense + sparse)
 - Semantic reranking
 - Intent-based semantic weighting

## Function: `apply_hybrid_weights`
[Section titled “Function: apply_hybrid_weights”](#function-apply_hybrid_weights)

**

```
apply_hybrid_weights()
```

Apply static weights to hybrid search scores (in-place).

Args: candidates: List of search results with dense and sparse scores dense_weight: Weight for dense embeddings (default: 0.65) sparse_weight: Weight for sparse embeddings (default: 0.35)

Note: Modifies candidates in place by updating the score attribute.

## Function: `apply_semantic_weighting`
[Section titled “Function: apply_semantic_weighting”](#function-apply_semantic_weighting)

**

```
apply_semantic_weighting()
```

Apply semantic importance weighting based on intent.

Args: base_score: Base relevance score chunk: CodeChunk with potential semantic metadata intent_type: Detected query intent agent_task: Corresponding agent task boost_factor: Maximum boost percentage (default: 0.2 = 20%)

Returns: Final score with semantic weighting applied

## Function: `process_reranked_results`
[Section titled “Function: process_reranked_results”](#function-process_reranked_results)

**

```
process_reranked_results()
```

Process reranked results and apply semantic weighting.

Args: reranked_results: Results from reranking provider original_candidates: Original search results (for mapping back) intent_type: Detected query intent agent_task: Corresponding agent task

Returns: List of SearchResult objects with updated scores

## Function: `process_unranked_results`
[Section titled “Function: process_unranked_results”](#function-process_unranked_results)

**

```
process_unranked_results()
```

Process results without reranking, applying semantic weighting to base scores.

Args: candidates: Original search results intent_type: Detected query intent agent_task: Corresponding agent task

Returns: List of SearchResult objects with updated relevance scores