Total Searches
208
Searches Today
0
Data Categories
8
Total Data
247
1. Pattern Matching with LIKE Query
Main Algorithm
Uses SQL LIKE operator with %query% wildcard to find substrings in each searchable column.
foreach ($searchableColumns as $column) {
$q->orWhere($column, 'like', '%' . $query . '%');
}
Complexity
O(n × m)
n = number of records, m = number of columns
Use Case
Substring search across multiple columns with OR logic
Example:
Query: "mahasiswa"
- ✓ "Program untuk mahasiswa baru"
- ✓ "Mahasiswa PTIK juara"
- ✓ "Pertukaran mahasiswa"
2. Relevance Scoring Algorithm
Tiered Scoring System
Each search result is scored based on its relevance to the query.
| Match Condition | Score | Example |
|---|---|---|
| Exact Match | +100 | Query: "ptik" → "ptik" |
| Starts With | +50 | Query: "prog" → "program" |
| Contains | +25 | Query: "ram" → "program" |
| Word Match % | +(n/total × 10) | Query: "mahasiswa ptik" → 2/2 words = +10 |
Calculation Example:
Query: "workshop ptik"
Data: "Workshop Web Development PTIK"
- • Exact match: 0
- • Starts with "workshop": +50
- • Contains "ptik": +25
- • Word match: 2/2 words = +10
Total Score: 85
3. Fuzzy Search (Levenshtein Distance)
Typo Tolerance
Uses the Levenshtein Distance algorithm to measure minimum edit distance between two strings.
Insert
Add a character
Delete
Remove a character
Replace
Replace a character
Typo Correction Example:
Threshold: The system accepts results with distance <= 2, meaning up to 2 edit operations to correct typos.
4. "Did You Mean" Suggestions
Smart Query Correction
Provides alternative suggestions when results are low or empty, using a combination of 3 similarity algorithms for better accuracy.
Multi-Algorithm Similarity:
Calculates character-level similarity percentage between strings
Measures minimum edit distance (normalized)
Calculates overlapping words across both queries
"Did You Mean" Examples:
Typo detection: 1 incorrect character
Missing character: a at the end
Missing character: a in the middle
Data Sources
- • Popular searches (history)
- • Content from database
- • Filtered by results > 0
Threshold
- • Popular: similarity > 60%
- • Content: similarity > 65%
- • Maximum suggestions: 3
When it appears: "Did You Mean" is shown when search results are < 3 or no results are found, helping users find what they need even with typos.
5. Related Search Discovery
Query Expansion & Discovery
Finds related searches sharing similar keywords with user queries to support discovery and content exploration.
Related Searches Algorithm:
-
1
Word Extraction: Extract words from the user query
explode(' ', $query) -
2
Search History: Query searches with results > 0 and count > 1
-
3
Word Matching: Count common words using
array_intersect() -
4
Ranking: Sort by common-word count then search popularity
Related Searches Example:
User searches: "registration"
User searches: "ptik lecturer"
Benefits
- • Content discovery
- • Query refinement
- • Improved user engagement
- • Reduced bounce rate
Configuration
- • Minimum common words: >= 1
- • Minimum search count: > 1
- • Maximum results: 5
- • Must have results > 0
6. Trending Topics Analysis
Real-time Trending Detection
Analyzes search patterns over a time window to identify trending and popular topics among users.
Trending Algorithm:
Analyze searches from the last 7 days (configurable)
GROUP BY query
+ COUNT(*)
to count frequency
Minimum 3x searches with results > 0
ORDER BY search_count DESC
Trending This Week Example:
graduation 2025
45 searches • ~12 avg results
scholarship
38 searches • ~8 avg results
student exchange program
29 searches • ~15 avg results
Time Window
7 days
Min Frequency
3×
Top Results
10
Use Case: Trending topics help users discover popular content, improve engagement, and provide insight into what users are searching for now.
7. Autocomplete (Prefix Matching)
Real-time Suggestions
Uses prefix matching to find words that start with user input.
Source 1: Search History
Suggestions based on previous searches (user behavior)
Source 2: Actual Content
Suggestions derived from database content
Autocomplete Example:
Input: "prog"
8. Voice Search (Web Speech API)
Hands-Free Search Experience
Uses Web Speech API to convert user speech into text queries, providing a more accessible and modern search experience.
Technology & API:
SpeechRecognition
or
webkitSpeechRecognition
Configured for Indonesian language:
lang: 'id-ID'
Instant speech-to-text conversion with visual feedback
How Voice Search Works:
User clicks microphone icon
Button turns red and starts listening
Speech recognition is active
System captures audio from microphone
Convert speech to text
Audio is converted into transcript text
Autofill search input
Transcript is inserted into input field
Trigger autocomplete
Suggestions appear automatically
Error Handling:
No speech detected
Microphone access denied
Internet connection error
Browser Support
Chrome, Edge, Safari
Accessibility
Hands-free search
Performance
Real-time processing
Benefits: Voice search improves accessibility for users with disabilities, enhances mobile experience, and speeds up searching without typing.
Search Data Coverage
News
15
records
Blogs
5
records
Events
5
records
Announcements
9
records
Lecturers
35
records
Testimonials
4
records
Student Works
9
records
Kerja Sama
165
records
Total: The system searches across 247 records from 8 categories.
Performance Summary
| Feature | Algorithm | Complexity | Use Case |
|---|---|---|---|
| Main Search | Pattern Matching (LIKE) | O(n×m) |
Substring search |
| Relevance | Weighted Scoring | O(n×m×k) |
Ranking results |
| Fuzzy Search | Levenshtein Distance | O(n×m²) |
Typo tolerance |
| Did You Mean | Multi-Similarity (3 algos) | O(n×m) |
Query correction |
| Related Searches | Word Overlap + Ranking | O(n×k) |
Query expansion |
| Trending Topics | Frequency Analysis | O(n log n) |
Popularity tracking |
| Autocomplete | Prefix Matching | O(log n) |
Real-time suggestions |
| Voice Search | Web Speech API | O(1) |
Speech-to-text |
System Strengths
- User-friendly typo tolerance
- Relevant results with scoring algorithm
- Smart suggestions with "Did You Mean"
- Content discovery via Related Searches
- Real-time trending topic tracking
- Voice search for accessibility
- Hands-free search experience
- Fast with database optimization
- Scalable and easy to extend
Analytics & Tracking
- Log every search
- Popular and trending searches
- Zero-result tracking
- User behavior analysis
Try the Search Feature
Explore our powerful search system with multiple algorithms for the best results
Start Searching