AppleScript - mdfind kMDItemTextContent script to find specified content from display dialog query
Try:

set searchText to text returned of (display dialog "Enter your search text:" default answer "")
set matchText to paragraphs of (do shell script "mdfind \"kMDItemTextContent == " &amp; quoted form of searchText &amp; "\"")
if matchText ≠ {} then
    set targetMatch to (choose from list matchText) as string
    if targetMatch ≠ "false" then tell application "Finder" to open (POSIX file targetMatch) as alias
end if