TEST-SEARCH.mdโข5.2 kB
# ๐ SAP Docs Search Testing Guide
Test the enhanced context-aware search functionality using these testing tools.
## ๐ Test Files Available
### 1. **Simple Search Test** (`test-search.ts`)
Quick command-line search testing with any keyword.
```bash
# Test with default keyword
npx tsx test-search.ts
# Test specific keywords
npx tsx test-search.ts wizard
npx tsx test-search.ts "cds entity"
npx tsx test-search.ts "wdi5 testing"
npx tsx test-search.ts annotation
```
**Features:**
- โฑ๏ธ Performance timing
- ๐ Result summary
- ๐ฏ Context detection display
- ๐ Top result preview
### 2. **Interactive Search Test** (`test-search-interactive.ts`)
Advanced testing with multiple modes and analysis.
```bash
# Interactive mode
npx tsx test-search-interactive.ts
# Run all predefined tests
npx tsx test-search-interactive.ts all
# Test specific query
npx tsx test-search-interactive.ts "your search term"
```
**Interactive Commands:**
- `all` - Run all predefined test cases
- `list` - Show predefined test cases
- `quit` / `exit` - Exit interactive mode
- Any keyword - Test search
**Features:**
- ๐งช Predefined test cases with expected contexts
- โ
Context validation
- ๐ Library breakdown analysis
- ๐ Top result highlighting
- โฑ๏ธ Performance metrics
### 3. **HTTP API Tests** (`test-search.http`) โ
**WORKING**
Test the HTTP server endpoints (requires VS Code REST Client or similar).
**First, start the HTTP server:**
```bash
npm run start:http
```
**Then use the `.http` file to test:**
- Server status check
- Various search queries
- Context-specific tests
- **Full search functionality** with context-aware results
**Example response for "wizard":**
```json
{
"role": "assistant",
"content": "Found 10 results for 'wizard' ๐จ **UI5 Context**:\n\n๐น **UI5 API Documentation:**\nโญ๏ธ **sap.f.SidePanel** (Score: 100)..."
}
```
## ๐ฏ Test Categories
### **UI5 Context Tests**
```bash
npx tsx test-search.ts wizard
npx tsx test-search.ts "sap.m.Button"
npx tsx test-search.ts "fiori elements"
```
Expected: ๐จ **UI5 Context** with UI5 API/Samples first
### **CAP Context Tests**
```bash
npx tsx test-search.ts "cds entity"
npx tsx test-search.ts service
npx tsx test-search.ts aspect
```
Expected: ๐๏ธ **CAP Context** with CAP Documentation first
### **wdi5 Context Tests**
```bash
npx tsx test-search.ts "wdi5 testing"
npx tsx test-search.ts "browser automation"
npx tsx test-search.ts "e2e test"
```
Expected: ๐งช **wdi5 Context** with wdi5 Documentation first
### **Mixed Context Tests**
```bash
npx tsx test-search.ts annotation
npx tsx test-search.ts authentication
npx tsx test-search.ts routing
```
Expected: Context varies based on strongest signal
## ๐ Understanding Results
### **Context Detection** ๐ฏ
- **๐จ UI5 Context**: UI5 controls, Fiori, frontend development
- **๐๏ธ CAP Context**: CDS, entities, services, backend development
- **๐งช wdi5 Context**: Testing, automation, browser testing
- **๐ MIXED Context**: Cross-platform or unclear context
### **Scoring System** โญ
- **Score 100**: Perfect matches
- **Score 90+**: High relevance matches
- **Score 80+**: Good matches with context boost
- **Score 70+**: Moderate relevance
- **Score <70**: Lower relevance (often filtered out)
### **Library Prioritization** ๐
Results are ordered by relevance score, with context-aware penalties:
- **CAP queries**: OpenUI5 results get 70% penalty (unless integration-related)
- **wdi5 queries**: OpenUI5 results get 80% penalty (unless testing-related)
- **UI5 queries**: CAP/wdi5 results get 60% penalty (unless backend/testing-related)
## ๐งช Example Test Session
```bash
# Start interactive testing
npx tsx test-search-interactive.ts
๐ Enter search term (or command): wizard
๐ฏ Detected context: UI5
โ
Context match: YES โ
๐ Top result: โญ๏ธ **sap.f.SidePanel** (Score: 100)...
๐ Libraries found: UI5-API, UI5-Samples
๐ Enter search term (or command): cds entity
๐ฏ Detected context: CAP
โ
Context match: YES โ
๐ Top result: โญ๏ธ **Core / Built-in Types** (Score: 100)...
๐ Libraries found: CAP
๐ Enter search term (or command): all
๐งช Running all predefined test cases...
[Runs comprehensive test suite]
```
## ๐ Quick Start
1. **Test a simple search:**
```bash
npx tsx test-search.ts wizard
```
2. **Run the full test suite:**
```bash
npx tsx test-search-interactive.ts all
```
3. **Test HTTP API (optional):**
```bash
npm run start:http
# Then use test-search.http file
```
## ๐ Performance Benchmarks
Typical search times:
- **Simple queries**: 1-3 seconds
- **Complex queries**: 2-5 seconds
- **First search** (cold start): May take longer due to index loading
## ๐ง Troubleshooting
**No results found:**
- Check spelling
- Try broader terms
- Use predefined test cases to verify system works
**Slow performance:**
- First search loads index (normal)
- Subsequent searches should be faster
- Check available memory
**Wrong context detection:**
- Context is based on keyword analysis
- Mixed contexts are normal for generic terms
- Use more specific terms for better context detection