This Django project, named Semantic Search Engine, is a powerful search engine designed specifically for e-commerce websites. It enables users to input their queries and retrieves the most relevant products from a database based on semantic similarity scores. By leveraging natural language processing techniques, the search engine aims to provide accurate and intuitive search results for enhanced user experience.
"Semantic Search Engine" has real-life applications in various scenarios, especially in e-commerce websites. Here's an explanation of its real-life usage and how it differs from normal search:
-
Enhanced Product Search Experience: The Semantic Search Engine improves the search experience for users on e-commerce websites. Instead of relying solely on keyword matching, it considers the semantic similarity between user queries and product descriptions. This means that users can search using natural language queries and still receive accurate and relevant product recommendations.
-
Improved Product Discovery: By utilizing semantic similarity, the search engine can identify products that closely match the user's intent, even if they don't explicitly use the exact search terms. This helps users discover relevant products that they may not have found through traditional keyword-based searches.
-
Higher Precision and Relevance: The Semantic Search Engine provides more precise and relevant search results compared to traditional search engines. It takes into account the meaning and context of user queries and product descriptions, enabling it to deliver more accurate recommendations that align with user intent.
-
Natural Language Support: The search engine understands and processes natural language queries effectively. Users can express their search queries in a more conversational and intuitive manner, similar to how they would ask a question or describe a product in a normal conversation. This makes the search process more user-friendly and accessible.
-
Contextual Understanding: The Semantic Search Engine goes beyond individual keywords and takes into account the context and meaning of the entire query. It understands the relationship between words and phrases, enabling it to provide more contextually relevant search results. This context-awareness helps in filtering out irrelevant products and improving the overall search quality.
To set up the Semantic Search Engine project, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/your-username/semantic-search-engine.git
-
Create a virtual environment.
python -m venv venv
-
Activate the virtual environment.
source venv/bin/activate -
Install the required dependencies.
pip install -r requirements.txt
This project makes use of the Sentence Transformer Model to convert the names of all the products into embeddings, the user query is also converted into embeddings so that the similarity score can be found between the user query and all products in the database, then the top 20 product is found out from the database on the basis of highest similarity score with the query.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('all-MiniLM-L6-v2')-
Start the Django development server.
python manage.py runserver
-
Access the project through your web browser by visiting http://localhost:8000
-
Signup or login in case if you have an account already.
-
Enter your search query in the provided search input field. Click the search button or press Enter to initiate the search.
-
The search engine will compare your query with the product descriptions in the database and display the most relevant products based on semantic similarity scores. Browse the search results and click on individual products for more details.
