PTIK UNIMA logo

PTIK UNIMA

Loading page...

Hero Background

Algorithm Search

Explanation of techniques and algorithms used in the search system

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:

mahasisw mahasiswa Distance: 1
progam program Distance: 1
acra acara Distance: 1

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:

1. Similar Text Algorithm 40% weight

Calculates character-level similarity percentage between strings

2. Levenshtein Distance 40% weight

Measures minimum edit distance (normalized)

3. Word Overlap Score 20% weight

Calculates overlapping words across both queries

"Did You Mean" Examples:

progam studi program studi 95% match

Typo detection: 1 incorrect character

mahasisw mahasiswa 92% match

Missing character: a at the end

pendftaran pendaftaran 88% match

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. 1
    Word Extraction: Extract words from the user query explode(' ', $query)
  2. 2
    Search History: Query searches with results > 0 and count > 1
  3. 3
    Word Matching: Count common words using array_intersect()
  4. 4
    Ranking: Sort by common-word count then search popularity

Related Searches Example:

User searches: "registration"

new student registration 45x searches
undergraduate registration requirements 32x searches
registration schedule 28x searches

User searches: "ptik lecturer"

ptik unima lecturers 38x searches
ptik lecturer profile 25x searches

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:

Time Window

Analyze searches from the last 7 days (configurable)

Frequency Analysis

GROUP BY query + COUNT(*) to count frequency

Quality Filter

Minimum 3x searches with results > 0

Ranking

ORDER BY search_count DESC

Trending This Week Example:

1

graduation 2025

45 searches • ~12 avg results

2

scholarship

38 searches • ~8 avg results

3

student exchange program

29 searches • ~15 avg results

Time Window

7 days

Min Frequency

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"

ptik study program history
programming competition news
partnership program events

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:

Web Speech API

SpeechRecognition or webkitSpeechRecognition

Language Support

Configured for Indonesian language: lang: 'id-ID'

Real-time Processing

Instant speech-to-text conversion with visual feedback

How Voice Search Works:

1
User clicks microphone icon

Button turns red and starts listening

2
Speech recognition is active

System captures audio from microphone

3
Convert speech to text

Audio is converted into transcript text

4
Autofill search input

Transcript is inserted into input field

5
Trigger autocomplete

Suggestions appear automatically

Error Handling:

no-speech

No speech detected

not-allowed

Microphone access denied

network

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

PTIK Assistant

Online • Ready to help

Hi! 👋

I am PTIK’s virtual assistant. How can I help you?

Your conversation is secure