{
"event": "PreToolUse",
"tool_name": "Bash",
"tool_input": {
"command": "php -r '\nrequire_once \"src\/Infrastructure\/AI\/OllamaService.php\";\nrequire_once \"src\/Infrastructure\/AI\/QdrantService.php\";\nrequire_once \"src\/Infrastructure\/AI\/ScoringService.php\";\n\nuse Infrastructure\\AI\\OllamaService;\nuse Infrastructure\\AI\\QdrantService;\nuse Infrastructure\\AI\\ScoringService;\n\n$ollama = new OllamaService();\n$qdrant = new QdrantService();\n$scoring = new ScoringService();\n\n$question = \"Was ist systemisches Coaching?\";\necho \"Query: $question\\n\\n\";\n\n\/\/ Embedding erzeugen\n$embedding = $ollama->getEmbedding($question);\necho \"Embedding: \" . count($embedding) . \" dimensions\\n\\n\";\n\n\/\/ Qdrant-Suche\n$results = $qdrant->search($embedding, \"documents\", 5);\necho \"=== RAW Qdrant Results ===\\n\";\nforeach ($results as $i => $r) {\n $title = substr($r[\"payload\"][\"document_title\"] ?? \"N\/A\", 0, 40);\n echo sprintf(\"%d. Score: %.4f | %s\\n\", $i+1, $r[\"score\"], $title);\n}\n\n\/\/ Mit Weighted Scoring\necho \"\\n=== Mit Weighted Scoring ===\\n\";\nforeach ($results as &$result) {\n $processedAt = $result[\"payload\"][\"processed_at\"] ?? null;\n $documentDate = $processedAt ? new DateTime($processedAt) : new DateTime();\n $authorityScore = (float)($result[\"payload\"][\"authority_score\"] ?? 0.5);\n \n $result[\"weighted_score\"] = $scoring->calculateScore(\n $result[\"score\"],\n $documentDate,\n $authorityScore\n );\n}\nusort($results, fn($a, $b) => ($b[\"weighted_score\"] ?? 0) <=> ($a[\"weighted_score\"] ?? 0));\n\nforeach ($results as $i => $r) {\n $title = substr($r[\"payload\"][\"document_title\"] ?? \"N\/A\", 0, 35);\n echo sprintf(\"%d. Raw: %.4f → Weighted: %.4f | %s\\n\", \n $i+1, $r[\"score\"], $r[\"weighted_score\"], $title);\n}\n' 2>&1",
"description": "Full RAG scoring test with real data"
}
}