rag-module 0.6.7

Enterprise RAG module with chat context storage, vector search, session management, and model downloading. Rust implementation with Node.js compatibility.
//! Debug search with NO threshold to see all matches

use anyhow::Result;
use rag_module::*;
use rag_module::services::search_service::EstateSearchOptions;

#[tokio::main]
async fn main() -> Result<()> {
    println!("🔍 NO THRESHOLD SEARCH DEBUG");
    println!("============================\n");
    
    let rag = create_rag_module("./test_data").await?;
    rag.initialize().await?;
    
    let user_id = "test_user_123";
    
    // Test EC2 search with NO threshold
    println!("🔍 EC2 SEARCH - NO THRESHOLD (all potential matches):");
    let ec2_results = rag.search_service.search_estate_resources(
        "ec2 instances",
        EstateSearchOptions {
            resource_types: None,
            account_ids: None,
            regions: None,
            services: Some(vec!["ec2".to_string()]),
            states: None,
            environment: None,
            application: None,
            synced_after: None,
            limit: Some(20), // Get lots of results
            score_threshold: None, // NO THRESHOLD!
            include_metadata: true,
            use_anonymous_ids: false,
        },
        None,
        user_id,
    ).await?;
    
    println!("Found {} EC2 results:", ec2_results.len());
    for (i, result) in ec2_results.iter().enumerate() {
        let id = result.get("id").and_then(|v| v.as_str()).unwrap_or("unknown");
        let service = result.get("service").and_then(|v| v.as_str()).unwrap_or("unknown");
        let resource_type = result.get("resource_type").and_then(|v| v.as_str()).unwrap_or("unknown");
        let instance_id = result.get("instance_id").and_then(|v| v.as_str()).unwrap_or("none");
        let score = result.get("score").and_then(|v| v.as_f64()).unwrap_or(0.0);
        
        println!("  {}. ID: {}", i + 1, id);
        println!("     Service: {}, Type: {}", service, resource_type);
        println!("     Instance ID: {}", instance_id);
        println!("     Score: {:.6}", score);
        println!();
    }
    
    println!("{}", "=".repeat(60));
    
    // Test RDS search with NO threshold
    println!("🔍 RDS SEARCH - NO THRESHOLD:");
    let rds_results = rag.search_service.search_estate_resources(
        "rds databases",
        EstateSearchOptions {
            resource_types: None,
            account_ids: None,
            regions: None,
            services: Some(vec!["rds".to_string()]),
            states: None,
            environment: None,
            application: None,
            synced_after: None,
            limit: Some(20),
            score_threshold: None, // NO THRESHOLD!
            include_metadata: true,
            use_anonymous_ids: false,
        },
        None,
        user_id,
    ).await?;
    
    println!("Found {} RDS results:", rds_results.len());
    for (i, result) in rds_results.iter().enumerate() {
        let id = result.get("id").and_then(|v| v.as_str()).unwrap_or("unknown");
        let service = result.get("service").and_then(|v| v.as_str()).unwrap_or("unknown");
        let resource_type = result.get("resource_type").and_then(|v| v.as_str()).unwrap_or("unknown");
        let db_id = result.get("db_instance_identifier").and_then(|v| v.as_str()).unwrap_or("none");
        let score = result.get("score").and_then(|v| v.as_f64()).unwrap_or(0.0);
        
        println!("  {}. ID: {}", i + 1, id);
        println!("     Service: {}, Type: {}", service, resource_type);
        println!("     DB ID: {}", db_id);
        println!("     Score: {:.6}", score);
        println!();
    }
    
    Ok(())
}