Search code examples
iosswiftsirikit

How to force Siri to search for text in my application


I have app with several short texts. I want Siri to be able to search for these texts.

The only way I found is to use INSearchForNotebookItemsIntent. But when using this approach, the user should say the word "note" (in my example below - at the end of the sentence). The words "list" and "task" are also suitable.

That is, a search using Siri works well if to say to it(her?):

On TextBook show Movies note

But this phrase makes Siri to search in the Internet:

On TextBook show Movies

My goal is to give users a convenient search through the application (without having to say the strange words "note", "list", which do not reflect the essence of what the user is looking for)

So I need:

  • either to force Siri to search without saying the word "note"
  • or make Siri understand other words instead of "note" (for example, "record").

How can I do that?

Please feel free to asking more details if you need


Solution

  • Short answer: you can't. The INSearchForNotebookItemsIntent is designed to search notes, tasks or reminders, not to search any arbitrary text.

    Apple doesn't let you change most of the necessary keywords Siri is looking through when calling an Intent Handler. Sadly it isn't documented explicitly what are the necessary keywords for each intent or what are the sentences that a specific intent will recognize. You can try to create a custom vocabulary to make Siri call your app intent with sentences slightly different than what it would recognize by default, but you still won't be able to omit some keywords or change the structure of the recognized sentences completely. Moreover, this is a trial and error process due to the lack of exact documentation.

    If you are still interested in solving your issue by using a custom vocabulary file, see the Registering custom vocabulary with SiriKit article from the official documentation.