If the search should only consider the opened books, the commented out line would be the fastest (in execution time) solution. Unfortunately Adobe never supported the full power of AppleScript, where you could push that kind of expressions into the scripted application. The line below works by building a list and performing the search in the AppleScript runtime.

Translating that to ExtendScript requires a shim for Array.indexOf ...

Btw, I would not rely on those strings from book contents without thorough testing - books can get moved in the FS. Some of the properties used to be redundant and/or only partially maintained when a book recovered from such a move, I never checked whether that was cleaned up internally in the file format when the bug was fixed ages ago.