{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/HybridSearchService.php",
"offset": 253,
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Docs\/HybridSearchService.php",
"content": " \/** Re-ranks results based on combined semantic and structural relevance. *\/\n private function rerank(array $results, string $query): array\n {\n $queryWords = array_filter(preg_split('\/\\s+\/', strtolower($query)) ?: []);\n\n foreach ($results as &$result) {\n $boost = 0.0;\n\n \/\/ Boost for keyword matches\n foreach ($result['keywords'] as $keyword) {\n foreach ($queryWords as $word) {\n if (stripos($keyword, $word) !== false) {\n $boost += 0.05;\n }\n }\n }\n\n \/\/ Boost for entity matches\n foreach ($result['entities'] as $entity) {\n if (isset($entity['name'])) {\n foreach ($queryWords as $word) {\n if (stripos($entity['name'], $word) !== false) {\n $boost += 0.03;\n }\n }\n }\n }\n\n \/\/ Boost for title matches\n foreach ($queryWords as $word) {\n if (stripos($result['title'], $word) !== false) {\n $boost += 0.1;\n }\n }\n\n $result['relevance_score'] = min(1.0, $result['score'] + $boost);\n }\n\n \/\/ Sort by relevance score\n usort($results, static fn (array $a, array $b): int => $b['relevance_score'] <=> $a['relevance_score']);\n\n return $results;\n }\n\n \/** Gets chunk with document data. *\/\n private function getChunkWithDocument(int $chunkId): ?array\n {\n $stmt = $this->pdo->prepare('\n SELECT c.*, d.title as doc_title, d.path as doc_path\n FROM dokumentation_chunks c",
"numLines": 50,
"startLine": 253,
"totalLines": 360
}
}
}