from data_ingestion.utils import search, load_embedded_data
import sys, os

#  Add the root directory to sys.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from loggings.logging_config import logger



# loading the embedded data
embed_db = load_embedded_data()



if __name__ == "__main__":
    logger.info("Receiving the search query")
    query = input("Enter the search query: ")
    logger.info(f"Searching for {query}")
    page_content, all, pages = search(embed_db, query)
    logger.info("Search completed")
    logger.info(f"Page content: {page_content}")
    print(f"Page content: {page_content}")
    print(f"Pages: {pages}")
    print("Search completed")