All you need to feed the smartfield is a LookupCall.
Either a service-based LookupCall using a LookupService or a LocalLookupCall where you implement the lookup logic directly inside the LocalLookupCall.
This way you can integrate whatever technology into a smartfield.
What I can see so far is, that when hitting a key the LookupCall.getDataByText() is called. And there everything is retrieved from the data source and afterwards the filter is applied.
Wouldn't it be much more sufficient to let the data source do the querying? Because lets assume I have a table with 1 mio orders... The whole table would be fetched and then just after the retrieval the filter would be applied...
for the case of millions of rows you are right of course. in that case you might want to go for a custom implementation for the ILookupService. for an sql based backend you can also extend the conveniene class AbstractSqlLookupService (a specific example being the PersonLookupService in the scout "contacts" application .
in these examples the data source returns only a subset to the smartfield, so even if the data source contains millions of records only 100 matching examples are extracted. in the case of a consuming smart field a notice is shown to the user that the data source contains more examples that are shown to the user.