Hi Frederic,
If you're writing XForms by hand, and use it in the "dynamic mode", you get an event fr-search-changed when the search text has changed, and you can control whether to call the service or not. It's very easy in that situation not call the service of the "search text" is too short, and in fact there is even an example of this in the documentation:
http://doc.orbeon.com/form-runner/component/autocomplete.html#dynamicSimilarly, leveraging delayed events, you could write some logic in XForms so you're not calling your service before a certain time has elapsed.
In resource mode, which is what you get if building the form with Form Builder, you could simulate your length requirement by writing a resource URL that looks like:
?country-name={if (string-length($fr-search-value) < 5) then '' else $fr-search-value}
So in effect, your service won't get called with strings of less than 5 characters.
Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet