Skip to main content
Skip table of contents

Automate Search Index Updates

If you add or remove a dataset from SuperSERVER, you will need to update the search index to keep it in sync.

If you regularly make changes to the catalogue, you may want to consider setting up your deployment to automatically update the search index.

This section describes one option for automating search index updates: creating a batch file that automatically exports the current catalogue and executes the indexing script. Once this is set up you can configure it to run at regular intervals.

Step 1 - Create a Macro File

The first step is to create a SuperADMIN macro file that will generate a list of all the datasets on the server.

  1. Create a text file called createdatabaselist.sam
  2. Open the file in a text editor and add the following commands:

    createdatabaselist.sam

    CODE
    login user1 user1
    createdatabaselist "C:\ProgramData\STR\SuperSERVER SA\" localhost "C:\ProgramData\STR\SuperADMIN\MetaData\MetaDataUtilities\databases.txt" true
    logout
    quit

    This macro logs in to SuperADMIN and generates a list of all the datasets in the catalogue.

    You will need to replace the username and password on the first line with the username and password of an administrator user on your deployment.

    You may also need to change some of the arguments to the createdatabaselist command. In particular:

    • The first argument (C:\ProgramData\STR\SuperSERVER SA\) is the prefix to be added to any relative paths. It should be set to the SuperSERVER program data directory. If SuperSERVER is not installed to the default location then you will need to change this.
    • The third argument (C:\ProgramData\STR\SuperADMIN\MetaData\MetaDataUtilities\databases.txt) is the location where the list file will be created. You will most likely want to save this file to the same directory as the search indexing script.

    See the documentation for the createdatabaselist command for more information about these options.

  3. Save your completed macro file to the SuperADMIN macros directory. By default, this is C:\ProgramData\STR\SuperADMIN\console\macros

Step 2 - Create AutoIndex.bat

The next step is to create a text file called AutoIndex.bat and save this to the same directory as the search indexing scripts. By default, this is C:\ProgramData\STR\SuperADMIN\MetaData\MetaDataUtilities

Open AutoIndex.bat in a text editor and paste in the following contents:

AutoIndex.bat

TEXT
@echo off 
REM This is an automation utility for creating index files used by SuperADMINs 
REM search functionality script can be run as a scheduled task 
REM This is suitable for the most common deployment of SuperADMIN server and 
REM SuperSERVER on a single host. 
REM configure the directory where SA Console is installed 
SET SA_CONSOLE_INSTALL_FOLDER=%programdata%\STR\SuperADMIN\console
REM create a macro that logs in as an administrative user and creates a list of datasets. 
REM Read help on the command "createdatabaselist" for more information on how to create a databaselist 
REM Configure the name of the macro file to create a list of dataseys
REM Make sure this macro exists in the directory defined for storing macros 
SET MACRO_TO_CREATEDATABASELIST=createdatabaselist.sam 
echo Creating datasey list... 
call %SA_CONSOLE_INSTALL_FOLDER%\Console.bat "-Dmacro=createdatabaselist.sam">autoindex.log
type autoindex.log | find "logged in" > NUL
if errorlevel 1 goto ERROR 
:BUILDINDEX 
echo Building index ... 
call BuildSXV4SearchIndex.bat 
GOTO SUCCESS
:ERROR echo Check if SA console is installed in %SA_CONSOLE_INSTALL_FOLDER% 
GOTO END 
:SUCCESS 
echo Search Index file created 
:END 
del autoindex.log 

You may need to make some changes to this file:

  • If you have installed SuperADMIN to a non standard location, you will need to update the definition of SA_CONSOLE_INSTALL_FOLDER (line 7) to point to the directory where the SuperADMIN Console.bat script is located on your system.
  • If the name of the macro file you just created is not createdatabaselist.sam then you will need to change the definition of MACRO_TO_CREATEDATABASELIST (line 12) to match whatever you called your macro file.
  • If you have multilingual datasets on your system you will need to change line 19 from call BuildSXV4SearchIndex.bat to call BuildMetadataSearchIndex.bat (you will also need to make sure you have configured the required settings in the BuildMetadataSearchIndex.bat script).

Once you have finished creating AutoIndex.bat, it is a good idea to run the batch file to check it runs correctly and updates the search index. If there are any errors displayed, check your settings and try again.

Step 3 - Set up a Scheduled Task

The final step is to create a scheduled task and configure it to execute AutoIndex.bat at your preferred interval.

In Windows, you can create a scheduled task from Control Panel > System and Security > Administrative Tools > Schedule Tasks.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.