Search Engine Basic
1️⃣ Search Engine কি?
Search Engine হলো এমন একটি সফটওয়্যার সিস্টেম যা বিশাল ডাটার মধ্যে থেকে খুব দ্রুত প্রাসঙ্গিক তথ্য খুঁজে বের করে।
সহজভাবে বললে:
User একটি keyword লিখবে → Search engine সেই keyword অনুযায়ী data খুঁজে বের করে result দেখাবে।
Example 1 (Website Search)
ধরো তুমি একটি E-commerce website বানিয়েছো।
Database এ products আছে:
1. Apple iPhone 15
2. Samsung Galaxy S24
3. Apple MacBook Air
4. Dell Laptop
User search করলো:
iphone
Search engine result দিবে:
Apple iPhone 15
Example 2 (Video Search)
ধরো তুমি YouTube এ search করো:
python tutorial
Result আসবে:
Python tutorial for beginners
Python full course
Python project tutorial
Example 3 (Web Search)
তুমি যদি Google এ লিখো:
best programming language
তাহলে Google লাখ লাখ ওয়েবসাইট থেকে সবচেয়ে relevant result দেখায়।
2️⃣ Index কি?
Index হলো এমন একটি data structure যেখানে data এমনভাবে সাজানো থাকে যাতে দ্রুত search করা যায়।
Database এর সাথে তুলনা করলে:
| Database | OpenSearch |
|---|---|
| Database | Index |
| Table | Document Collection |
Example 1
ধরো একটি product index আছে।
product_index
এর মধ্যে document থাকবে:
Product 1
Product 2
Product 3
Example 2 (Library Example)
ধরো একটি লাইব্রেরি আছে।
বইগুলো খুঁজতে library কি করে?
একটা index card system রাখে।
A → Algorithms book
B → Biology book
C → Computer Science book
এটাই index।
3️⃣ Document কি?
Document হলো একটি single record বা data object।
এটা সাধারণত JSON format এ থাকে।
Example 1 (Product Document)
{
"name": "iPhone 15",
"brand": "Apple",
"price": 1200
}
এটা একটি document।
Example 2 (User Document)
{
"name": "Ali",
"age": 23,
"city": "Dhaka"
}
এটাও একটি document।
Example 3 (Blog Document)
{
"title": "Learn OpenSearch",
"author": "Ali",
"category": "Programming"
}
4️⃣ Field কি?
Field হলো document এর একটি property।
Database এ যাকে column বলে।
Example
{
"name": "iPhone 15",
"brand": "Apple",
"price": 1200
}
এখানে field হলো:
name
brand
price
Example 2
{
"name": "Ali",
"age": 23,
"city": "Dhaka"
}
Fields:
name
age
city
5️⃣ Query কি?
Query হলো search করার instruction।
User যখন search করে তখন backend এ query run হয়।
Example 1
User search করলো:
iphone
Query হতে পারে:
Find products where name contains iphone
Example 2
User search করলো:
price less than 1000
Query:
Find products where price < 1000
Example 3
User search করলো:
brand = Apple
Query:
Find all Apple products
6️⃣ Full-Text Search কি?
Full-Text Search হলো এমন search যেখানে পুরো text এর মধ্যে match খোঁজা হয়।
এটা শুধু exact match না, বরং:
similar words
related words
partial match
সব খুঁজে বের করে।
Example 1
Database data:
Learn Python Programming
Python Tutorial for Beginners
Advanced Python Course
User search করলো:
python
Result:
Learn Python Programming
Python Tutorial for Beginners
Advanced Python Course
Example 2
User search করলো:
programming
Result:
Learn Python Programming
Java Programming Guide
Example 3 (Typo correction)
User লিখলো:
pythn
Search engine বুঝবে:
python
এবং result দিবে।
Real World System
এই ধরনের search system ব্যবহার করে:
Amazon (product search)
YouTube (video search)
Google (web search)
আর এই ধরনের search system তৈরি করতে ব্যবহার করা হয়:
👉 OpenSearch
Mentor Tip (খুব গুরুত্বপূর্ণ)
OpenSearch বুঝতে হলে ৩টা জিনিস মনে রাখো:
Index → Database
Document → Row
Field → Column