Help search index not found

Being a novice I have been using the help documentation frequently as I learn how to do what I want!
Suddenly, I started getting the error:
Search index not found
when searching the documentation on my laptop installation. I started using my PC installation instead to search the help pages but since today get the same error message! In both cases I can still browse the documentation - I just can't search it anymore.
I have no idea what could have caused this on both systems. Maybe there was a Windows update that causes problems?
I have Matlab R2017b (9.3.0.713579) on both machines running Windows 7 with an academic license.
Does anyone know how to restore the search index?
Thanks

Answers (1)

Jan
Jan on 22 Jan 2018
See https://www.mathworks.com/help/matlab/ref/builddocsearchdb.html for re-creating the search database. Maybe this helps you to find the corresponding files in the help folders and restore them from the backup (see "recent versions" or "file history"). But if the data base vanished on both computers, there must be a connection. Maybe one of your functions overwrites them or you have shadowed a built-in function, such that the search fails? Check this by e.g. https://www.mathworks.com/matlabcentral/fileexchange/27861-uniquefuncnames.

4 Comments

Thanks for the help. I tried to rebuild using builddocsearchdb but get the following error:
>> builddocsearchdb('D:\Program Files\Matlab\R2017b\help\matlab')
Error using builddocsearchdb (line 38)
Could not write search database.
>>
I should have permission to the folder and made sure it is in my path but it still happens (on both my machines). Seems I am not the only one with this problem. https://www.mathworks.com/matlabcentral/answers/33803-build-doc-search-db-failure
You can use the debugger to step through the code of builddocsearchdb (hopefully it is not a P-file). This might reveal, why which file cannot be written. Check the file permissions again for this file and folder. Maybe it helps to start Matlab as an administrator - but it is safer not to do this for productive use.
Hi
Still no luck. I can create, rename and delete files in that folder as a normal user so that shouldn't be the issue. Running as administrator gave the same result. By debugger, do you mean the code editor that opens when I click on the 'line 38' link in the error?
Line 38 of builddocsearchdb is : error('MATLAB:doc:CannotBuildSearchDb','%s',getString(message('MATLAB:doc:CouldNotWriteSearchDatabase')));
and the full code is below to show it in context.
The error seems generated by the failure of this condition: success = com.mathworks.mlwidgets.help.customdoc.CustomToolboxIndexer.index(helploc);
Maybe this can help identify the problem?
function builddocsearchdb(helploc)
% BUILDDOCSEARCHDB Build documentation search database
% BUILDDOCSEARCHDB HELP_LOCATION builds a search database for MYTOOLBOX
% documentation in HELP_LOCATION, which the Help browser uses to perform
% searches that include the documentation for My Toolbox. Use
% BUILDDOCSEARCHDB for My Toolbox HTML help files you add to the Help
% browser via an INFO.XML file. BUILDDOCSEARCH creates a directory named
% HELPSEARCH in HELP_LOCATION. The HELPSEARCH directory works only with
% the version of MATLAB used to create it.
%
% Examples:
% builddocsearchdb([matlabroot '/toolbox/mytoolbox/help']) - builds the
% search database for the documentation found in the directory
% /toolbox/mytoolbox/help under the MATLAB root.
%
% builddocsearchdb D:\Work\mytoolbox\help - builds the search database
% for the documentation files found at D:\Work\mytoolbox\help.
% Copyright 2006-2012 The MathWorks, Inc.
if ~usejava('jvm')
error('MATLAB:doc:CannotBuildSearchDb','%s',getString(message('MATLAB:doc:UnsupportedPlatform',upper(mfilename))));
end
if isstring(helploc)
helploc = char(helploc);
end
if (~exist(helploc,'file'))
error('MATLAB:doc:CannotBuildSearchDb','%s',getString(message('MATLAB:doc:SpecifiedDirectoryDoesNotExist')));
end
if ~isHelpLocAvailable(helploc)
error(message('MATLAB:doc:DocNotInstalled'));
end
if (com.mathworks.mlwidgets.help.HelpPrefs.isShow3pDocInHelpBrowser)
success = com.mathworks.mlwidgets.help.customdoc.CustomToolboxIndexer.index(helploc);
if ~success
*error('MATLAB:doc:CannotBuildSearchDb','%s',getString(message('MATLAB:doc:CouldNotWriteSearchDatabase')));*
end
else
try
com.mathworks.mlwidgets.help.search.lucene.LuceneIndexServices.indexDoc(helploc);
catch
error('MATLAB:doc:CannotBuildSearchDb','%s',getString(message('MATLAB:doc:CouldNotWriteSearchDatabase')));
end
end
disp(getString(message('MATLAB:doc:CreatedSearchDatabase')));
end
% Handle the failure that if user try to build the doc
% for a custom toolbox before the help system is notified that
% the toolbox is on the path.
function isDocInstalled = isHelpLocAvailable(helploc)
isDocInstalled = 0;
for counter = 1:10
if ~com.mathworks.mlwidgets.help.HelpInfo.isInstalledProductHelpLocation(helploc)
pause(1);
else
isDocInstalled = 1;
break
end
end
end
I had the same error with R2020a (but not with the previous versions). My code was:
... publish files in 'C:\PathToDirWithInfoXml\html'
% Renew addpath(<directory path info.xml>)
rmpath('C:\PathToDirWithInfoXml\')
addpath('C:\PathToDirWithInfoXml\')
builddocsearchdb('C:\PathToDirWithInfoXml\html');
It turned out, that since R2020a, the filesep at the end of the string argument for rmpath(...) and addpath(...) leads to problems. Now, this is working:
... publish files in 'C:\PathToDirWithInfoXml\html'
% Renew addpath(<directory path info.xml>)
rmpath('C:\PathToDirWithInfoXml') % pathWithoutFilesep = fileparts(pathWithFilesep)
addpath('C:\PathToDirWithInfoXml')
builddocsearchdb('C:\PathToDirWithInfoXml\html');

Sign in to comment.

Categories

Asked:

on 22 Jan 2018

Commented:

on 15 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!