@Julian – as you can see in the DOM documentation, you cannot add a hyperlink to text. You can add a hyperlink to a document with the add() method:
Adobe InDesign CS6 (8.0) Object Model JS: Hyperlink
Adobe InDesign CS6 (8.0) Object Model JS: Hyperlinks
The add() method has three arguments. None of them is optional:
1. Source
2. Destination
3. Object (for setting the properties with their values of the hyperlink)
Since you want to work with found text the source will be a HyperlinkTextSource that is also added to the document:
Adobe InDesign CS6 (8.0) Object Model JS: HyperlinkTextSource
Adobe InDesign CS6 (8.0) Object Model JS: HyperlinkTextSources
Same goes with the destination. You could use a destination already in the document or create a new one by adding it to the document. There are various kinds of destinations. You did not tell the destination. So I'm not clear what to suggest here. Look your options up in the DOM documentation:
Adobe InDesign CS6 (8.0) Object Model JS: Table of Contents, Hyperlinks Suite
Or download the chm file version of the documentation at:
Uwe