Restrict the search on specific fields

Sometimes, searching on all fields is not relevant and may even involve big performance issues. You can restrict the search on specific fields only using the option searchFields.

SQL
Mongodb

In this example, we configure Forest Admin to only search on the fields name and industry of our collection companies.

/forest/companies.js
const Liana = require('forest-express-sequelize');
Liana.collection('companies', {
searchFields: ['name', 'industry'],
});

In this example, we configure Forest to only search on the fields name and industry of our collection companies.

/forest/companies.js
const Liana = require('forest-express-mongoose');
Liana.collection('companies', {
searchFields: ['name', 'industry'],
});