Skip to content

3. Batch Import

Jesus Baron edited this page Jul 15, 2022 · 3 revisions

Importing Users/Items

If you have existing users and items in your application's database, it is very likely that you might want to import them into Recombee to feed the recommendation algorithms and start computing good results with the existing data.

Prior to batch importing your data, it is highly recommended to configure what data is to be exported from the models, please see section 2. Configuration.

Using Artisan Command

This package provides a recombee:import Artisan command that you may use to import all of your existing records into your Recombee database.

# Import both users and items
php artisan recombee:import

# Import users only
php artisan recombee:import -u

# Import items only
php artisan recombee:import -i

Programmatically

The static method makeAllRecommendable is available on your model to import all of your existing records. Functionally, it is identical to using the Artisan command from right above.

User::makeAllRecommendable();
Item::makeAllRecommendable();