Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
77968d0
Add all code related to storing embeddings in a custom table, from cr…
dkotter Jun 4, 2026
4b1a3c1
Create table on plugin activation or for existing users, on admin_ini…
dkotter Jun 4, 2026
cc6853d
Migrate any Features that used embeddings over to the new data structure
dkotter Jun 4, 2026
5fc247f
Migrate any Providers that used embeddings over to the new data struc…
dkotter Jun 4, 2026
a17a7c3
Add unit tests
dkotter Jun 4, 2026
adff7cc
Abstract out all the shared functionality from the individual embeddi…
dkotter Jun 5, 2026
0e0f8be
Merge branch 'develop' into feature/vector-db
dkotter Jun 5, 2026
62e4bcc
For multisite, when a site is deleted, delete our custom table
dkotter Jun 5, 2026
ab74714
Merge branch 'develop' into feature/vector-db
dkotter Jun 8, 2026
6629492
Decrease our migration batch from 100 to 50
dkotter Jun 8, 2026
8aba6a1
Ensure we delete the embedding data when the underlying object is del…
dkotter Jun 8, 2026
d6bf81e
Ensure we generate new embeddings when a term is updated
dkotter Jun 8, 2026
1c56a08
Ensure we keep the created_at date when doing an update
dkotter Jun 8, 2026
bc06462
Ensure we remove posts from our recommended cache when they are no lo…
dkotter Jun 8, 2026
1668bbd
Fix PHPCS warning
dkotter Jun 8, 2026
0a5c5bf
Merge branch 'develop' into feature/vector-db
dkotter Jun 9, 2026
25fa618
Merge branch 'develop' into feature/vector-db
dkotter Jun 15, 2026
8932547
Fix new test failure
dkotter Jun 15, 2026
b3dbf1c
Try and fix flaky tests. Ensure our E2E tests properly run on differe…
dkotter Jun 15, 2026
ee93608
Merge branch 'develop' into feature/vector-db
dkotter Jun 15, 2026
d934abe
More attempt to fix flaky tests
dkotter Jun 15, 2026
57896f9
Few more fixes to make tests more predictable
dkotter Jun 15, 2026
98430e5
Merge branch 'develop' into feature/vector-db
dkotter Jun 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,11 @@ jobs:
matrix:
core:
- { name: 'WP latest', version: 'latest' }
- { name: 'WP minimum', version: 'https://wordpress.org/wordpress-6.9.zip' }
- { name: 'WP trunk', version: 'WordPress/WordPress#master' }
- { name: 'WP minimum', version: '6.9' }
- { name: 'WP trunk', version: 'trunk' }
env:
WP_ENV_PHP_VERSION: 8.3
WP_ENV_CORE: ${{ matrix.core.version == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.core.version ) }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -389,8 +392,10 @@ jobs:
command: |
npm run env:start

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Log versions
run: |
npm run env -- run cli php -- -v
npm run env -- run cli wp core version

- name: Run E2E tests
run: npm run test:e2e
Expand Down
4 changes: 4 additions & 0 deletions classifai.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ function classifai_autoload_notice() {
*/
function classifai_activation() {
set_transient( 'classifai_activation_notice', 'classifai', HOUR_IN_SECONDS );

if ( classifai_autoload() ) {
\Classifai\Embeddings\Schema::maybe_install();
}
}
register_activation_hook( __FILE__, 'classifai_activation' );

Expand Down
66 changes: 66 additions & 0 deletions includes/Classifai/Command/ClassifaiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,72 @@ private function print( $output, $post_id ) {
\WP_CLI::warning( "Failed to classify $post_id: " . $output->get_error_message() );
}
}

/**
* Migrate legacy embedding meta into the classifai_embeddings table.
*
* Runs the backfill inline, without Action Scheduler. Useful for hosts where
* Action Scheduler is paused or for large sites that want a controlled run.
*
* ## Options
*
* [--batch-size=<int>]
* : Number of objects to process per batch. Default 100.
*
* ## EXAMPLES
*
* wp classifai migrate-embeddings
* wp classifai migrate-embeddings --batch-size=500
*
* @param array $args Positional args (unused).
* @param array $opts Associative options.
*/
public function migrate_embeddings( $args = array(), $opts = array() ) {
$batch_size = isset( $opts['batch-size'] ) ? max( 1, (int) $opts['batch-size'] ) : 100;

\Classifai\Embeddings\Schema::maybe_install();
$runner = new \Classifai\Embeddings\MigrationRunner();

\WP_CLI::log( 'Starting embeddings migration...' );

$total_migrated = 0;
$runner->mark_running();

while ( true ) {
$batch = $runner->scan( $batch_size );
if ( empty( $batch ) ) {
break;
}

$runner->process_batch( $batch );
$total_migrated += count( $batch );
\WP_CLI::log( sprintf( 'Migrated %d objects (cumulative: %d).', count( $batch ), $total_migrated ) );
}

$runner->mark_completed();
\WP_CLI::success( sprintf( 'Embeddings migration complete. Total objects migrated: %d.', $total_migrated ) );
}

/**
* Show the current status of the embeddings migration.
*
* ## EXAMPLES
*
* wp classifai embeddings-status
*
* @param array $args Positional args (unused).
* @param array $opts Associative options (unused).
*/
public function embeddings_status( $args = array(), $opts = array() ) {
unset( $args, $opts );
\Classifai\Embeddings\Schema::maybe_install();
$runner = new \Classifai\Embeddings\MigrationRunner();
$status = $runner->status();
$remaining = count( $runner->scan( PHP_INT_MAX ) );

\WP_CLI::log( sprintf( 'Status: %s', $status ) );
\WP_CLI::log( sprintf( 'Remaining: %d legacy meta rows', $remaining ) );
}
}

try {
Expand Down
Loading
Loading