51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
"""
|
|
Test all search handlers with a simple query.
|
|
"""
|
|
|
|
from execution.search_executor import SearchExecutor
|
|
|
|
def main():
|
|
"""Test all search handlers."""
|
|
# Initialize the search executor
|
|
executor = SearchExecutor()
|
|
|
|
# Execute search tests
|
|
print("\n=== TESTING GENERAL SEARCH ===")
|
|
general_results = executor.execute_search({
|
|
'raw_query': 'quantum computing',
|
|
'enhanced_query': 'quantum computing'
|
|
})
|
|
|
|
print("\n=== TESTING CODE SEARCH ===")
|
|
code_results = executor.execute_search({
|
|
'raw_query': 'implement merge sort in python',
|
|
'enhanced_query': 'implement merge sort algorithm in python with time complexity analysis',
|
|
'is_code': True
|
|
})
|
|
|
|
# Print general search results
|
|
print("\n=== GENERAL SEARCH RESULTS ===")
|
|
print(f'Results by source: {[engine for engine, res in general_results.items() if res]}')
|
|
print('\nDetails:')
|
|
for engine, res in general_results.items():
|
|
print(f'{engine}: {len(res)} results')
|
|
if res:
|
|
print(f' Sample result: {res[0]["title"]}')
|
|
|
|
# Print code search results
|
|
print("\n=== CODE SEARCH RESULTS ===")
|
|
print(f'Results by source: {[engine for engine, res in code_results.items() if res]}')
|
|
print('\nDetails:')
|
|
for engine, res in code_results.items():
|
|
print(f'{engine}: {len(res)} results')
|
|
if res:
|
|
print(f' Sample result: {res[0]["title"]}')
|
|
|
|
return {
|
|
'general': general_results,
|
|
'code': code_results
|
|
}
|
|
|
|
if __name__ == "__main__":
|
|
main()
|