solr migration button
This commit is contained in:
@@ -35,6 +35,25 @@ docker-compose up -d
|
||||
|
||||
**Best for**: Production environments where you need to preserve uptime.
|
||||
|
||||
**Method A: Automatic (Recommended)**
|
||||
```bash
|
||||
# Single endpoint that adds field and migrates data
|
||||
curl -X POST "http://your-app-host/api/admin/search/solr/migrate-library-schema" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
```
|
||||
|
||||
**Method B: Manual Steps**
|
||||
```bash
|
||||
# Step 1: Add libraryId field via app API
|
||||
curl -X POST "http://your-app-host/api/admin/search/solr/add-library-field" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
|
||||
# Step 2: Run migration
|
||||
curl -X POST "http://your-app-host/api/admin/search/solr/migrate-library-schema" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
```
|
||||
|
||||
**Method C: Direct Solr API (if app API fails)**
|
||||
```bash
|
||||
# Add libraryId field to stories core
|
||||
curl -X POST "http://your-solr-host:8983/solr/storycove_stories/schema" \
|
||||
@@ -62,13 +81,13 @@ curl -X POST "http://your-solr-host:8983/solr/storycove_authors/schema" \
|
||||
}
|
||||
}'
|
||||
|
||||
# Then use the admin migration endpoint
|
||||
# Then run the migration
|
||||
curl -X POST "http://your-app-host/api/admin/search/solr/migrate-library-schema" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
```
|
||||
|
||||
**Pros**: No downtime, preserves service availability
|
||||
**Cons**: More complex, requires API access
|
||||
**Pros**: No downtime, preserves service availability, automatic field addition
|
||||
**Cons**: Requires API access
|
||||
|
||||
### Option 3: Application-Level Migration (Recommended for Production)
|
||||
|
||||
@@ -142,10 +161,39 @@ After migration, verify that library separation is working:
|
||||
|
||||
### "unknown field 'libraryId'" Error
|
||||
|
||||
This means the Solr schema wasn't updated. Solutions:
|
||||
- Use Option 1 (volume reset) for clean restart
|
||||
- Use Option 2 (Schema API) to add the field manually
|
||||
- Check that schema files contain the libraryId field definition
|
||||
**Problem**: `ERROR: [doc=xxx] unknown field 'libraryId'`
|
||||
|
||||
**Cause**: The Solr schema doesn't have the libraryId field yet.
|
||||
|
||||
**Solutions**:
|
||||
|
||||
1. **Use the automated migration** (adds field automatically):
|
||||
```bash
|
||||
curl -X POST "http://your-app/api/admin/search/solr/migrate-library-schema"
|
||||
```
|
||||
|
||||
2. **Add field manually first**:
|
||||
```bash
|
||||
# Add field via app API
|
||||
curl -X POST "http://your-app/api/admin/search/solr/add-library-field"
|
||||
|
||||
# Then run migration
|
||||
curl -X POST "http://your-app/api/admin/search/solr/migrate-library-schema"
|
||||
```
|
||||
|
||||
3. **Direct Solr API** (if app API fails):
|
||||
```bash
|
||||
# Add to both cores
|
||||
curl -X POST "http://solr:8983/solr/storycove_stories/schema" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"add-field":{"name":"libraryId","type":"string","indexed":true,"stored":true}}'
|
||||
|
||||
curl -X POST "http://solr:8983/solr/storycove_authors/schema" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"add-field":{"name":"libraryId","type":"string","indexed":true,"stored":true}}'
|
||||
```
|
||||
|
||||
4. **For development**: Use Option 1 (volume reset) for clean restart
|
||||
|
||||
### Migration Endpoint Returns Error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user