137 lines
3.3 KiB
Markdown
137 lines
3.3 KiB
Markdown
# Search Engine Migration Cleanup Checklist
|
|
|
|
**Use this checklist when removing Typesense and completing the migration to OpenSearch.**
|
|
|
|
## 🗑️ Files to DELETE Completely
|
|
|
|
- [ ] `SearchMigrationManager.java` - Temporary migration manager
|
|
- [ ] `AdminSearchController.java` - Temporary admin endpoints for migration
|
|
- [ ] `TypesenseService.java` - Old search service (if exists)
|
|
- [ ] `TypesenseConfig.java` - Old configuration (if exists)
|
|
- [ ] Any frontend migration UI components
|
|
|
|
## 🔧 Files to MODIFY
|
|
|
|
### SearchServiceAdapter.java
|
|
Replace delegation with direct OpenSearch calls:
|
|
|
|
```java
|
|
@Service
|
|
public class SearchServiceAdapter {
|
|
|
|
@Autowired
|
|
private OpenSearchService openSearchService; // Only this remains
|
|
|
|
public void indexStory(Story story) {
|
|
openSearchService.indexStory(story); // Direct call, no delegation
|
|
}
|
|
|
|
public SearchResultDto<StorySearchDto> searchStories(...) {
|
|
return openSearchService.searchStories(...); // Direct call
|
|
}
|
|
|
|
// Remove all migration-related methods:
|
|
// - isDualWriteEnabled()
|
|
// - getMigrationStatus()
|
|
// - etc.
|
|
}
|
|
```
|
|
|
|
### pom.xml
|
|
Remove Typesense dependency:
|
|
```xml
|
|
<!-- DELETE this dependency -->
|
|
<dependency>
|
|
<groupId>org.typesense</groupId>
|
|
<artifactId>typesense-java</artifactId>
|
|
<version>1.3.0</version>
|
|
</dependency>
|
|
```
|
|
|
|
### application.yml
|
|
Remove migration configuration:
|
|
```yaml
|
|
storycove:
|
|
search:
|
|
# DELETE these lines:
|
|
engine: opensearch
|
|
dual-write: false
|
|
# DELETE entire typesense section:
|
|
typesense:
|
|
api-key: xyz
|
|
host: localhost
|
|
port: 8108
|
|
# ... etc
|
|
```
|
|
|
|
### docker-compose.yml
|
|
Remove Typesense service:
|
|
```yaml
|
|
# DELETE entire typesense service block
|
|
typesense:
|
|
image: typesense/typesense:0.25.1
|
|
# ... etc
|
|
|
|
# DELETE typesense volume
|
|
volumes:
|
|
typesense_data:
|
|
```
|
|
|
|
## 🌐 Environment Variables to REMOVE
|
|
|
|
- [ ] `TYPESENSE_API_KEY`
|
|
- [ ] `TYPESENSE_HOST`
|
|
- [ ] `TYPESENSE_PORT`
|
|
- [ ] `TYPESENSE_ENABLED`
|
|
- [ ] `SEARCH_ENGINE`
|
|
- [ ] `SEARCH_DUAL_WRITE`
|
|
|
|
## ✅ Configuration to KEEP (OpenSearch only)
|
|
|
|
```yaml
|
|
storycove:
|
|
opensearch:
|
|
host: ${OPENSEARCH_HOST:localhost}
|
|
port: ${OPENSEARCH_PORT:9200}
|
|
# ... all OpenSearch config remains
|
|
```
|
|
|
|
## 🧪 Testing After Cleanup
|
|
|
|
- [ ] Compilation successful: `mvn compile`
|
|
- [ ] All tests pass: `mvn test`
|
|
- [ ] Application starts without errors
|
|
- [ ] Search functionality works correctly
|
|
- [ ] No references to Typesense in logs
|
|
- [ ] Docker containers start without Typesense
|
|
|
|
## 📝 Estimated Cleanup Time
|
|
|
|
**Total: ~30 minutes**
|
|
- Delete files: 5 minutes
|
|
- Update SearchServiceAdapter: 10 minutes
|
|
- Remove configuration: 5 minutes
|
|
- Testing: 10 minutes
|
|
|
|
## 🚨 Rollback Plan (if needed)
|
|
|
|
If issues arise during cleanup:
|
|
|
|
1. **Immediate:** Restore from git: `git checkout HEAD~1`
|
|
2. **Verify:** Ensure application works with previous state
|
|
3. **Investigate:** Fix issues in a separate branch
|
|
4. **Retry:** Complete cleanup when issues resolved
|
|
|
|
## ✨ Post-Cleanup Benefits
|
|
|
|
- **Simpler codebase:** No dual-engine complexity
|
|
- **Reduced dependencies:** Smaller build artifacts
|
|
- **Better performance:** No dual-write overhead
|
|
- **Easier maintenance:** Single search engine to manage
|
|
- **Cleaner configuration:** Fewer environment variables
|
|
|
|
---
|
|
|
|
**Created:** 2025-09-18
|
|
**Purpose:** Temporary migration assistance
|
|
**Delete this file:** After cleanup is complete |