import requests import json def test_search_after_upload(): base_url = 'http://localhost:3015' headers = {'X-API-Key': 'jleu1212', 'Content-Type': 'application/json'} # Test search for bee content after the successful upload print('šŸ” Testing search after successful upload...') queries = ['bee', 'photo of a bee', 'Image Classifications:', 'docker windows'] for query in queries: try: response = requests.post(f'{base_url}/api/search', headers=headers, json={'query': query, 'top_k': 5}, timeout=15) if response.status_code == 200: results = response.json() chunks = results.get('chunks', []) print(f'\nāœ… Query: "{query}" - Found {len(chunks)} chunks') for i, chunk in enumerate(chunks): content = chunk.get('content', '') file_path = chunk.get('file_path', '') print(f' Chunk {i+1} from {file_path}:') # Check for classification content if 'Image Classifications:' in content: print(' āœ… CONTAINS CLASSIFICATION METADATA') # Find and show classification lines lines = content.split('\n') for line in lines: if 'Image Classifications:' in line or 'bee' in line.lower(): print(f' šŸ“ {line}') else: # Show preview of content preview = content[:150] + '...' if len(content) > 150 else content print(f' Preview: {preview}') else: print(f'āŒ Query "{query}" failed: {response.status_code}') except Exception as e: print(f'āŒ Query "{query}" error: {e}') if __name__ == '__main__': test_search_after_upload()