I have two models in my app: Book and BookFamily. There are about 20 million records in each.
A BookFamily has a main book.
Via Forest Admin, it’s impossible for us to edit the main book of a BookFamily. The BelongsTo Typeahead field times out.
I’ve noticed it’s because although we type in the Book ID, the query is doing a LIKE operation against all of the book fields, and it can take over 100 seconds.
When I manually run a query against my database only searching via the ID field, it returns in less than a millisecond.
Is there a way to configure the BelongsTo Typeahead fields to only search via ID?
Thank you for using Forest Admin with such a big number of data!!!
By definition the BelongsTo Typeahead will execute a query against all your fields.
However if you want to modify this behaviour, you will have to override your route and modify how forest-express-sequelize works internally.
Hopefully this will do what I need, without preventing us from doing filters on other Book properties when navigating books in general.
Will report back.
UPDATE: That has worked. Forest just breaks if I try and put a title in the search field now, which isn’t ideal. But we can now do what we need to do in most cases!