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
.
In this example, we configure Forest Admin to only search on the fields name
and industry
of our collection companies
.
/forest/companies.jsconst { collection } = require('forest-express-sequelize');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.jsconst { collection } = require('forest-express-mongoose');collection('companies', {searchFields: ['name', 'industry'],});
In this example, we configure Forest to only search on the fields name
and industry
of our collection Company
.
/lib/forest_liana/collections/company.rbclass Forest::Companyinclude ForestLiana::Collectioncollection :Companysearch_fields ['name', 'industry']action 'Mark as Live'# ...end