docs: record WordPress API URL update session progress
This commit is contained in:
156
docs_v1.0/M4_workspace/2026-05-29_wp_api_url_update.md
Normal file
156
docs_v1.0/M4_workspace/2026-05-29_wp_api_url_update.md
Normal file
@@ -0,0 +1,156 @@
|
||||
---
|
||||
title: WordPress API URL Update - 2026-05-29
|
||||
version: "1.0"
|
||||
date: 2026-05-29
|
||||
author: OpenCode
|
||||
status: in_progress
|
||||
---
|
||||
|
||||
# WordPress API URL Update Session
|
||||
|
||||
## Scope
|
||||
|
||||
Update WordPress Code Snippets to point momentry_core API from `m5api.momentry.ddns.net` / `api.momentry.ddns.net` to `192.168.110.201:3002` (M5Max48 LAN IP).
|
||||
|
||||
## Summary
|
||||
|
||||
| Item | Status |
|
||||
|------|--------|
|
||||
| URL update | ✅ Done |
|
||||
| `/scan` route | ✅ Working (122 files) |
|
||||
| `/search-proxy?mode=people` | ✅ Working (3788 results) |
|
||||
| `/search-proxy?mode=semantic` | ❌ Returns 0 results (direct API works with 20 results) |
|
||||
| `/search-proxy?mode=keyword` | ❌ Returns 0 results (direct API works with 21 results) |
|
||||
| Snippet #66 PHP syntax fix | ✅ Fixed (removed `.` before array keys) |
|
||||
| Added `limit/page/page_size` | ✅ Added to search bodies |
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. URL Updates
|
||||
|
||||
Changed in multiple snippets:
|
||||
|
||||
| Old URL | New URL |
|
||||
|---------|---------|
|
||||
| `https://m5api.momentry.ddns.net` | `http://192.168.110.201:3002` |
|
||||
| `https://api.momentry.ddns.net` | `http://192.168.110.201:3002` |
|
||||
| `localhost:3002` | `192.168.110.201:3002` |
|
||||
|
||||
Affected snippets: #37, #43, #44, #48, #55, #59, #60, #61, #62, #63, #64, #66, #67
|
||||
|
||||
### 2. Snippet #66 Fixes
|
||||
|
||||
**Before (syntax error)**:
|
||||
```php
|
||||
$body = [
|
||||
. 'query' => $query, // ❌ Invalid PHP syntax
|
||||
. 'limit' => 20,
|
||||
];
|
||||
```
|
||||
|
||||
**After (fixed)**:
|
||||
```php
|
||||
// Semantic search body
|
||||
$body = [
|
||||
'query' => $query,
|
||||
'limit' => 20,
|
||||
'page' => 1,
|
||||
'page_size' => 20,
|
||||
];
|
||||
|
||||
// Universal search body
|
||||
$body = [
|
||||
'query' => $query,
|
||||
'limit' => 20,
|
||||
'page' => 1,
|
||||
'page_size' => 20,
|
||||
];
|
||||
```
|
||||
|
||||
Note: `file_uuid` was NOT added per user request.
|
||||
|
||||
## Backup Location
|
||||
|
||||
```
|
||||
/Users/accusys/momentry_core/backups/wp_snippets_20260529_181847/
|
||||
```
|
||||
|
||||
Contains:
|
||||
- `wp_snippets_full.sql` - Full backup before any changes
|
||||
- `snippets_with_old_url.sql` - Snippets containing old URLs
|
||||
- `snippets_43_44_48_54_before_api_fix.sql`
|
||||
- `snippet_66_before_syntax_fix.sql`
|
||||
|
||||
## Restore Command
|
||||
|
||||
```bash
|
||||
mysql -u wp_user -p'wp_password_123' wordpress < /Users/accusys/momentry_core/backups/wp_snippets_20260529_181847/wp_snippets_full.sql
|
||||
```
|
||||
|
||||
## Pending Issue: Semantic/Keyword Search Returns Empty
|
||||
|
||||
### Symptoms
|
||||
|
||||
- Direct API call to momentry_core: Returns results
|
||||
- WP proxy call: Returns `{"results": [], "total": 0}`
|
||||
|
||||
### Direct API Test (Works)
|
||||
|
||||
```bash
|
||||
curl -s http://192.168.110.201:3002/api/v1/search/smart \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69' \
|
||||
-d '{"query":"love","limit":20,"page":1,"page_size":20}'
|
||||
# Returns 20 results
|
||||
```
|
||||
|
||||
### WP Proxy Test (Empty)
|
||||
|
||||
```bash
|
||||
curl -sk 'https://m5wp.momentry.ddns.net/wp-json/momentry/v1/search-proxy?mode=semantic&query=love'
|
||||
# Returns {"query":"love","results":[],"page":1,"page_size":20,"strategy":"semantic_vector_search"}
|
||||
```
|
||||
|
||||
### Hypothesis
|
||||
|
||||
1. WordPress `wp_remote_request` may encode JSON differently
|
||||
2. Header mismatch between WordPress and curl
|
||||
3. PHP `$body` array construction issue
|
||||
|
||||
### Debug Steps Needed
|
||||
|
||||
1. Add debug output to snippet to return the exact `$body` JSON being sent
|
||||
2. Check WordPress HTTP request logs
|
||||
3. Compare raw request payload from WordPress vs curl
|
||||
|
||||
### Temporary Workaround
|
||||
|
||||
Use people search (works) or call momentry_core directly from frontend bypassing WP proxy.
|
||||
|
||||
## Environment Context
|
||||
|
||||
| Server | IP | Port | Role |
|
||||
|--------|-----|------|------|
|
||||
| M5Max48 | 192.168.110.201 | 3002 | momentry_core production |
|
||||
| M5Max48 | 192.168.110.201 | 3003 | momentry_core playground (dev) |
|
||||
| M4mini | 192.168.110.210 | 443 | Caddy reverse proxy for WordPress |
|
||||
| WordPress | - | - | MariaDB, PHP-FPM 8.5, Code Snippets plugin |
|
||||
|
||||
## API Key
|
||||
|
||||
```
|
||||
muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69
|
||||
```
|
||||
|
||||
## Database State
|
||||
|
||||
- PostgreSQL: `momentry` database
|
||||
- `public.chunk`: 294,531 rows (has embeddings)
|
||||
- `public.videos`: 4 registered files including Charade_YouTube_24fps.mp4
|
||||
- Qdrant: `momentry_rule1` collection with embeddings
|
||||
|
||||
## Version History
|
||||
|
||||
| Version | Date | Author | Change |
|
||||
|---------|------|--------|--------|
|
||||
| 1.0 | 2026-05-29 | OpenCode | Initial session record |
|
||||
Reference in New Issue
Block a user