Skip to main content
Participating Frequently
April 9, 2021
Question

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

  • April 9, 2021
  • 3 replies
  • 2573 views

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 has been closed for replies.

3 replies

Participating Frequently
April 13, 2021

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...

 

Adobe Employee
April 15, 2021

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.

Participating Frequently
April 15, 2021

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.

Legend
April 10, 2021

If protected mode is on, try switching it off. 

Participating Frequently
April 10, 2021

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.

Participating Frequently
April 9, 2021

@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.