@@ -139,7 +139,7 @@ protected function showinfo()
139139 ];
140140 $ stats = array_merge (
141141 $ stats ,
142- array_map ( ' dformat ' , $ this ->helper ->getRunData () ),
142+ $ this ->helper ->getRunData (),
143143 $ this ->helper ->getStorage ()->statistics ()
144144 );
145145 $ this ->printTable ($ stats );
@@ -341,7 +341,7 @@ protected function runMaintenance()
341341 $ this ->notice ('Spent time: {time}min ' , ['time ' => round ((time () - $ start ) / 60 , 2 )]);
342342
343343 $ data = $ this ->helper ->getRunData ();
344- $ data ['maintenance ran at ' ] = time ();
344+ $ data ['maintenance ran at ' ] = dformat ();
345345 $ this ->helper ->setRunData ($ data );
346346 }
347347
@@ -354,13 +354,25 @@ protected function createEmbeddings($clear)
354354 {
355355 [$ skipRE , $ matchRE ] = $ this ->getRegexps ();
356356
357+ $ data = $ this ->helper ->getRunData ();
358+ $ lastEmbedModel = $ data ['embed used ' ] ?? '' ;
359+
360+ if (
361+ !$ clear && $ lastEmbedModel &&
362+ $ lastEmbedModel != (string ) $ this ->helper ->getEmbeddingModel ()
363+ ){
364+ $ this ->warning ('Embedding model has changed since last run. Forcing an index rebuild ' );
365+ $ clear = true ;
366+ }
367+
357368 $ start = time ();
358369 $ this ->helper ->getEmbeddings ()->createNewIndex ($ skipRE , $ matchRE , $ clear );
359370 $ this ->notice ('Peak memory used: {memory} ' , ['memory ' => filesize_h (memory_get_peak_usage (true ))]);
360371 $ this ->notice ('Spent time: {time}min ' , ['time ' => round ((time () - $ start ) / 60 , 2 )]);
361372
362- $ data = $ this ->helper ->getRunData ();
363- $ data ['embed ran at ' ] = time ();
373+
374+ $ data ['embed ran at ' ] = dformat ();
375+ $ data ['embed used ' ] = (string ) $ this ->helper ->getEmbeddingModel ();
364376 $ this ->helper ->setRunData ($ data );
365377 }
366378
0 commit comments