I am developing a Flutter app where, upon user input, the app needs to search within a PDF and return only the portion of text where the user-entered string appears. I'm using Firestore and have created a collection with two fields: the publication date of the PDF and the URL of the PDF (stored in Cloud Storage). There's a subcollection containing all the data from the PDF divided into parts. So, if a PDF has, for example, 2 pages, this subcollection would have, let's say, 8 documents, where each document contains only one field, and the value of this field is a part of the PDF text.
Here is a screenshot of how Firestore is configured.:

I think it's necessary to perform a string match on subtexts, possibly with a query in Firestore, but I'm unsure how or if it's possible to do so.
Ideas?