Question
· Aug 5

Validate Global Indexes and Rebuild them

Hello, how are you?

First of all thanks for your time reading this question.

 

We are investigating how to validate the indexes of a global. We have read:

https://docs.intersystems.com/irisforhealth20251/csp/docbook/DocBook.UI....

And:

https://docs.intersystems.com/irisforhealth20251/csp/documatic/%25CSP.Do...

 

We want to validate the inxedes of the global titled "Ens.Util.LogD". We have executed on the ObjectScript terminal, on the desired namespace:

ESBSSCC>set tSC = $SYSTEM.OBJ.ValidateIndices("Ens.Util.LogD","",0,1,0,1,.errors)

 

Being the output:

ESBSSCC>zw tSC
    tSC="0 "_$lb($lb(5002,"<UNDEFINED>loadtab+2^%ocsCacheSQLFiler0 ^oddEXTR(""Ens.Util.LogD"",91)",,,,,,,,$lb(,"ESBSSCC",$lb("^loadtab+2^%ocsCacheSQLFiler0^1","d^opentab+3^%ocsCacheSQLFiler0^2","e^filer+5^%ocsCacheSQLFiler^2","d^ValidateIndices+4^%SYS.SECURITY^1","e^zValidateIndices+12^%SYSTEM.OBJ.1^1","e^^^0"))))/* ERROR #5002: Error de cache: <UNDEFINED>loadtab+2^%ocsCacheSQLFiler0 ^oddEXTR("Ens.Util.LogD",91) */

 

In addition we have read:

https://docs.intersystems.com/irisforhealth20251/csp/docbook/DocBook.UI....

 

Because of the previous error, we have thought that rebuilding its indexes was needed, so we executed:

ESBSSCC>do ##class(Ens.Util.LogD).BuildIndex()

 

It says:

    DO ##CLASS(Ens.Util.LogD).BuildIndex()
    ^
    <CLASS DOES NOT EXIST> *Ens.Util.LogD

 

Then we tried:

ESBSSCC>do ##class(Ens.Util.Log).BuildIndex()

 

It outputs:

    DO ##CLASS(Ens.Util.Log).BuildIndex()
    ^
    <METHOD DOES NOT EXIST> *BuildIndex,Ens.Util.Log

 

 

 

What are we doing wrong?

How could we validate the index of the Global?

When do we need to rebuild its indexes?

 

Thank you so much for your help!

Product version: IRIS 2020.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2020.1.1 (Build 408U) Sun Mar 21 2021 22:21:14 EDT [HealthConnect:2.1.0+r1m1]
Discussion (2)3
Log in or sign up to continue

The %BuildIndices class method is used to rebuild all indices on the class. To run it asynchronously, use the following:

Do ##class(Ens.Util.Log).%BuildIndices()
Do ##class(Ens.Util.Log).%BuildIndicesAsync()

To rebuild a specific index, pass the index name as a list value:

Do ##class(Ens.Util.Log).%BuildIndices($LB("TimeLogged"))

You can also rebuild indices using SQL from 2021 version

Rebuild all indices

BUILD INDEX FOR TABLE Ens_Util.Log

Rebuild a specific index

BUILD INDEX FOR TABLE Ens_Util.Log INDEX TimeLogged

Hi Yone,

The documentation you reference is for IRIS for Health 2025.1, while you note that your product version is IRIS 2020.1. The methods differ between versions, so looking at the 2020.1 documentation will show you the valid methods to use for your version.

If you see the documentation for IRIS 2020.1 Ens.Util.Log, you can see under the Inherited Methods (Including Private Methods) section that there is no BuildIndex() option, which explains why the error you get is <METHOD DOES NOT EXIST>.

Looking at the correct documentation version, there is information for IRIS 2020.1 on Building Indices and on Validating Indices. The documentation notes that "The preferred way of building indices is to use the %BuildIndices() method or the %BuildIndicesAsync() method" as %Library.Persistent.%BuildIndices() or %Library.Persistent.%BuildIndicesAsync(). There is further information on the recommended cases for each.

Hopefully this helps point you to a successful method!