Skip to main content
Participating Frequently
Apr 9, 2021 10:55 PM UTC
Question

Building search index through JavaScript no longer works: "Failed to open file"

I need to create a search index for some documents.

It seems like the JavaScript API does not support creating new search indices. For this reason, I have created an empty search index manually. I can use that to build the index like this:

 

// Global declaration

var oldDoc = null;
var buildIndexJob = null;

var buildIndex = app.trustedFunction( function(cDIPath, cExpr, bRebuildAll) {
    app.beginPriv();
    oldDoc = app.activeDocs[0];
    buildIndexJob = catalog.getIndex(cDIPath).build("doc=oldDoc; " + cExpr, bRebuildAll);	
    app.endPriv();
});

// This is how I use the function
buildIndex('/C/Some/Path/My Index.pdx', 'app.alert("Done");', true);

 

For years, this has worked just fine. However, recently the code stopped working.

The log file reads like this:

Indexing 261 files
Extracting : C:\Users\....\SomeDocument.pdf
Fatal Search Engine Error : (-11) Failed to open file
Deleting files from current index
Error: Index build failed

What is strange is that I can create the search index just fine through the Acrobat GUI.

Using Process Monitor, I don't see any problems like the PDF document not being accessible  - so it's not clear to me which file Acrobat failed to open.

 

We use this code to generate search indices for different files. It could be related to the specific files, but it could also be due to an Acrobat update.

Any idea how I could debug this?

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Participating Frequently
Apr 13, 2021 4:35 PM UTC

We are using .NET to invoke the JavaScript. I believe the .NET code is accessing some COM/ActiveX library.

But I don't think that's relevant as I get the same error when I run the JavaScript from the JavaScript console inside Acrobat.

 

We are using Acrobad DC Pro (32-bit), version 2021.001.20145.

In case that helps...

 

Translate
Adobe Employee
Apr 15, 2021 12:00 PM UTC

Hi,

 

Thanks for your bug report. Could you please try the registry under Solution#2 mentioned in the https://helpx.adobe.com/acrobat/kb/unable-to-search-text-in-pdf.html and let us know if the workaround is working for you?

 

Thanks & Regards,

Adobe Acrobat DC Desktop Team.

Translate
Participating Frequently
Apr 15, 2021 12:49 PM UTC

Hi @adeep93 

Thank you very much for getting back to me.

I first had to create the "FeatureState" key under "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Adobe\Adobe Acrobat\DC\" as it didn't exist.

I then added the "bFallbackOnix32" DWORD value as described.

 

Then I ran the script again. Now the index rebuilding process window shows:

"Starting rebuild of Index : C:\Users\...\My index file.pdx"

But the process never even seems to start. It is stuck on "Status: Idle", as you can see in the screenshot.

Before, the process was successfully counting all files, and then it would fail upon trying to index the first file (while it was working fine when doing the same operation through the GUI).

With the registry fix in place, it does not even count the files.

Translate
Legend
Apr 10, 2021 7:06 AM UTC

If protected mode is on, try switching it off. 

Translate
Participating Frequently
Apr 10, 2021 1:35 PM UTC

Thanks for the suggestion. Protected mode was not on, only enhanced security was on.

I have switched off enhanced security, but that didn't make any difference, unfortunately.

Translate
Participating Frequently
Apr 9, 2021 11:30 PM UTC

@Meenakshi Negi @adeep93 

I see you have recently fixed bugs related to the search index. Could that have broken my code? I'm running Acrobat Pro DC 2021.001.20145.

 

Translate